Skip to content

Commit 0c57e43

Browse files
committed
Merge remote-tracking branch 'origin/master'
# Conflicts: # c89stringutils/c89stringutils_string_extras.h
2 parents 5cbd597 + ad6d0bf commit 0c57e43

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

.github/workflows/linux-Windows-macOS-sunOS.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ jobs:
2323
with:
2424
prepare: pkg install cmake wget
2525
run: |
26-
mkdir build && cd build
27-
mkdir -p c89stringutils_tests/test_downloads
26+
mkdir -p build/c89stringutils_tests/test_downloads
27+
cd build
2828
/opt/ooce/bin/wget https://raw.githubusercontent.com/silentbicycle/greatest/11a6af1/greatest.h -o c89stringutils_tests/test_downloads/greatest.h
2929
/opt/ooce/bin/cmake -DCMAKE_BUILD_TYPE="Debug" ..
3030
/opt/ooce/bin/cmake --build .
31-
/opt/ooce/bin/ctest -C Debug .
31+
/opt/ooce/bin/ctest -C Debug --rerun-failed --output-on-failure .
3232
if: matrix.os == 'macos-10.15'
3333
- name: mkdir
3434
run: mkdir build
@@ -41,5 +41,5 @@ jobs:
4141
if: matrix.os != 'macos-10.15'
4242
- name: test
4343
working-directory: ./build
44-
run: ctest -C Debug .
44+
run: ctest -C Debug --rerun-failed --output-on-failure .
4545
if: matrix.os != 'macos-10.15'

c89stringutils_tests/test_c89stringutils/test_string_extras.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,23 @@ TEST x_strnstr_should_succeed(void) {
1212
}
1313

1414
TEST x_strnstr_should_fail(void) {
15-
ASSERT_EQ(strcmp(buffer, strnstr(buffer, target, strlen(buffer))), 0);
15+
ASSERT_STR_EQ(buffer, strnstr(buffer, target, strlen(buffer)));
16+
PASS();
17+
}
18+
19+
TEST x_asprintf_should_succeed(void) {
20+
char *s = NULL;
21+
asprintf(&s, "foo%s", "bar");
22+
ASSERT_STR_EQ("foobar", s);
23+
free(s);
1624
PASS();
1725
}
1826

1927
TEST x_jasprintf_should_succeed(void) {
2028
char *s = NULL;
2129
jasprintf(&s, "foo%s", "bar");
2230
jasprintf(&s, "can%s", "haz");
23-
ASSERT_EQ(strcmp(s, "foobarcanhaz"), 0);
31+
ASSERT_STR_EQ("foobarcanhaz", s);
2432
free(s);
2533
PASS();
2634
}
@@ -29,5 +37,6 @@ TEST x_jasprintf_should_succeed(void) {
2937
SUITE(strnstr_suite) {
3038
RUN_TEST(x_strnstr_should_succeed);
3139
RUN_TEST(x_strnstr_should_fail);
40+
RUN_TEST(x_asprintf_should_succeed);
3241
RUN_TEST(x_jasprintf_should_succeed);
3342
}

0 commit comments

Comments
 (0)