diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/core/test_vprintf.in | 18 | ||||
-rw-r--r-- | tests/core/test_vprintf.out | 2 | ||||
-rw-r--r-- | tests/test_core.py | 25 |
3 files changed, 23 insertions, 22 deletions
diff --git a/tests/core/test_vprintf.in b/tests/core/test_vprintf.in new file mode 100644 index 00000000..fcaad9d9 --- /dev/null +++ b/tests/core/test_vprintf.in @@ -0,0 +1,18 @@ + + #include <stdio.h> + #include <stdarg.h> + + void print(char* format, ...) { + va_list args; + va_start (args, format); + vprintf (format, args); + va_end (args); + } + + int main () { + print("Call with %d variable argument.\n", 1); + print("Call with %d variable %s.\n", 2, "arguments"); + + return 0; + } +
\ No newline at end of file diff --git a/tests/core/test_vprintf.out b/tests/core/test_vprintf.out new file mode 100644 index 00000000..16f21510 --- /dev/null +++ b/tests/core/test_vprintf.out @@ -0,0 +1,2 @@ +Call with 1 variable argument. +Call with 2 variable arguments. diff --git a/tests/test_core.py b/tests/test_core.py index cdee3c76..5f5e7645 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -3594,29 +3594,10 @@ ok self.do_run_from_file(src, output) def test_vprintf(self): - src = r''' - #include <stdio.h> - #include <stdarg.h> - - void print(char* format, ...) { - va_list args; - va_start (args, format); - vprintf (format, args); - va_end (args); - } - - int main () { - print("Call with %d variable argument.\n", 1); - print("Call with %d variable %s.\n", 2, "arguments"); + test_path = path_from_root('tests', 'core', 'test_vprintf') + src, output = (test_path + s for s in ('.in', '.out')) - return 0; - } - ''' - expected = ''' - Call with 1 variable argument. - Call with 2 variable arguments. - ''' - self.do_run(src, re.sub('(^|\n)\s+', '\\1', expected)) + self.do_run_from_file(src, output) def test_vsnprintf(self): if self.emcc_args is None: return self.skip('needs i64 math') |