aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 15:06:06 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:59 +0200
commitaa11da7eff43adb57f935763f22c10abdff5279d (patch)
tree068ad274246310138a1b39d143b98007953469da
parent71abd62af718a75477e0fb3feb954278d811a044 (diff)
Use do_run_from_file() for test_vprintf
-rw-r--r--tests/core/test_vprintf.in18
-rw-r--r--tests/core/test_vprintf.out2
-rw-r--r--tests/test_core.py25
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')