Skip to content

Commit

Permalink
Fix possibly uninit var.
Browse files Browse the repository at this point in the history
Fixes #49.
  • Loading branch information
sheredom committed Jan 12, 2021
1 parent d783188 commit 0c617a1
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
3 changes: 2 additions & 1 deletion test/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ UTEST(utest_cmdline, filter_with_list) {
hits = (char *)malloc(utest_state.tests_length);
memset(hits, 0, utest_state.tests_length);

ASSERT_EQ(0, subprocess_create(command, subprocess_option_combined_stdout_stderr,
ASSERT_EQ(0,
subprocess_create(command, subprocess_option_combined_stdout_stderr,
&process));

stdout_file = subprocess_stdout(&process);
Expand Down
15 changes: 7 additions & 8 deletions test/test.c
Original file line number Diff line number Diff line change
@@ -1,34 +1,35 @@
/*
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
For more information, please refer to <http://unlicense.org/>
*/

#include "utest.h"

#ifdef _MSC_VER
/* disable 'conditional expression is constant' - our examples below use this! */
/* disable 'conditional expression is constant' - our examples below use this!
*/
#pragma warning(disable : 4127)
#pragma
#endif
Expand Down Expand Up @@ -108,9 +109,7 @@ UTEST_F_SETUP(MyTestF) {
utest_fixture->foo = 42;
}

UTEST_F_TEARDOWN(MyTestF) {
ASSERT_EQ(13, utest_fixture->foo);
}
UTEST_F_TEARDOWN(MyTestF) { ASSERT_EQ(13, utest_fixture->foo); }

UTEST_F(MyTestF, c) {
ASSERT_EQ(42, utest_fixture->foo);
Expand Down
4 changes: 1 addition & 3 deletions test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ UTEST_F_SETUP(MyTestF) {
utest_fixture->foo = 42;
}

UTEST_F_TEARDOWN(MyTestF) {
ASSERT_EQ(13, utest_fixture->foo);
}
UTEST_F_TEARDOWN(MyTestF) { ASSERT_EQ(13, utest_fixture->foo); }

UTEST_F(MyTestF, cpp_1) {
ASSERT_EQ(42, utest_fixture->foo);
Expand Down
4 changes: 1 addition & 3 deletions test/test11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,7 @@ UTEST_F_SETUP(MyTestF) {
utest_fixture->foo = 42;
}

UTEST_F_TEARDOWN(MyTestF) {
ASSERT_EQ(13, utest_fixture->foo);
}
UTEST_F_TEARDOWN(MyTestF) { ASSERT_EQ(13, utest_fixture->foo); }

UTEST_F(MyTestF, cpp11_1) {
ASSERT_EQ(42, utest_fixture->foo);
Expand Down
1 change: 1 addition & 0 deletions utest.h
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ utest_type_printer(long long unsigned int i) {
utest_state.tests_length)); \
utest_state.tests[index].func = &utest_##SET##_##NAME; \
utest_state.tests[index].name = name; \
utest_state.tests[index].index = 0; \
UTEST_SNPRINTF(name, name_size, "%s", name_part); \
} \
void utest_run_##SET##_##NAME(int *utest_result)
Expand Down

0 comments on commit 0c617a1

Please sign in to comment.