MCPcopy Create free account
hub / github.com/boostorg/build / execnt_unit_test

Function execnt_unit_test

v2/engine/execnt.c:151–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149 */
150
151void execnt_unit_test()
152{
153#if !defined( NDEBUG )
154 /* vc6 preprocessor is broken, so assert with these strings gets confused.
155 * Use a table instead.
156 */
157 {
158 typedef struct test { char * command; int result; } test;
159 test tests[] = {
160 { "", 0 },
161 { " ", 0 },
162 { "x", 1 },
163 { "\nx", 1 },
164 { "x\n", 1 },
165 { "\nx\n", 1 },
166 { "\nx \n", 2 },
167 { "\nx \n ", 2 },
168 { " \n\t\t\v\r\r\n \t x \v \t\t\r\n\n\n \n\n\v\t", 8 },
169 { "x\ny", -1 },
170 { "x\n\n y", -1 },
171 { "echo x > foo.bar", -1 },
172 { "echo x < foo.bar", -1 },
173 { "echo x | foo.bar", -1 },
174 { "echo x \">\" foo.bar", 18 },
175 { "echo x '<' foo.bar", 18 },
176 { "echo x \"|\" foo.bar", 18 },
177 { "echo x \\\">\\\" foo.bar", -1 },
178 { "echo x \\\"<\\\" foo.bar", -1 },
179 { "echo x \\\"|\\\" foo.bar", -1 },
180 { "\"echo x > foo.bar\"", 18 },
181 { "echo x \"'\"<' foo.bar", -1 },
182 { "echo x \\\\\"<\\\\\" foo.bar", 22 },
183 { "echo x \\x\\\"<\\\\\" foo.bar", -1 },
184 { 0 } };
185 test const * t;
186 for ( t = tests; t->command; ++t )
187 assert( raw_command_length( t->command ) == t->result );
188 }
189
190 {
191 int const length = maxline() + 9;
192 char * const cmd = (char *)BJAM_MALLOC_ATOMIC( length + 1 );
193 memset( cmd, 'x', length );
194 cmd[ length ] = 0;
195 assert( raw_command_length( cmd ) == length );
196 BJAM_FREE( cmd );
197 }
198#endif
199}
200
201
202/*

Callers 1

run_unit_testsFunction · 0.85

Calls 2

raw_command_lengthFunction · 0.85
maxlineFunction · 0.85

Tested by

no test coverage detected