@@ -51,32 +51,30 @@ bool build_and_run_test(Cmd *cmd, const char *test_name)
5151 return true;
5252}
5353
54- int main (int argc , char * * argv )
54+ nob_main (int argc , char * * argv , Cmd * cmd )
5555{
5656 NOB_GO_REBUILD_URSELF_PLUS (argc , argv , "nob .h ", "shared .h ");
5757
58- Cmd cmd = {0 };
59-
6058 const char * program_name = shift (argv , argc );
6159 const char * command_name = "test" ;
6260 if (argc > 0 ) command_name = shift (argv , argc );
6361
64- if (!mkdir_if_not_exists (BUILD_FOLDER )) return 1 ;
65- if (!mkdir_if_not_exists (BUILD_FOLDER TESTS_FOLDER )) return 1 ;
62+ if (!mkdir_if_not_exists (BUILD_FOLDER )) return false ;
63+ if (!mkdir_if_not_exists (BUILD_FOLDER TESTS_FOLDER )) return false ;
6664
6765 if (strcmp (command_name , "test" ) == 0 ) {
6866 if (argc <= 0 ) {
6967 for (size_t i = 0 ; i < test_names_count ; ++ i ) {
70- if (!build_and_run_test (& cmd , test_names [i ])) return 1 ;
68+ if (!build_and_run_test (cmd , test_names [i ])) return false ;
7169 }
72- return 0 ;
70+ return true ;
7371 }
7472
7573 while (argc > 0 ) {
7674 const char * test_name = shift (argv , argc );
77- if (!build_and_run_test (& cmd , test_name )) return 1 ;
75+ if (!build_and_run_test (cmd , test_name )) return false ;
7876 }
79- return 0 ;
77+ return true ;
8078 }
8179
8280 if (strcmp (command_name , "list" ) == 0 ) {
@@ -85,9 +83,9 @@ int main(int argc, char **argv)
8583 nob_log (INFO , " %s" , test_names [i ]);
8684 }
8785 nob_log (INFO , "Use %s test <names...> to run individual tests" , program_name );
88- return 0 ;
86+ return true ;
8987 }
9088
9189 nob_log (ERROR , "Unknown command %s" , command_name );
92- return 1 ;
90+ return false ;
9391}
0 commit comments