summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVasilis Kalintiris <ehostunreach@gmail.com>2013-12-06 23:23:53 +0200
committerVasilis Kalintiris <ehostunreach@gmail.com>2013-12-07 19:35:52 +0200
commit88ee912b36ba0f3e0ba0cd4f4506faaf3a175736 (patch)
tree0a5aed86cb230c044fc2f4c3539f35eac4f19b5b
parentb369cf755546f62ec1c0f4aa9216459b85bee8e7 (diff)
Use do_run_from_file() for test_errar
-rw-r--r--tests/core/test_errar.in21
-rw-r--r--tests/core/test_errar.out4
-rw-r--r--tests/test_core.py30
3 files changed, 28 insertions, 27 deletions
diff --git a/tests/core/test_errar.in b/tests/core/test_errar.in
new file mode 100644
index 00000000..7ef2b23d
--- /dev/null
+++ b/tests/core/test_errar.in
@@ -0,0 +1,21 @@
+
+ #include <stdio.h>
+ #include <errno.h>
+ #include <string.h>
+
+ int main() {
+ char* err;
+ char buffer[200];
+
+ err = strerror(EDOM);
+ strerror_r(EWOULDBLOCK, buffer, 200);
+ printf("<%s>\n", err);
+ printf("<%s>\n", buffer);
+
+ printf("<%d>\n", strerror_r(EWOULDBLOCK, buffer, 0));
+ errno = 123;
+ printf("<%d>\n", errno);
+
+ return 0;
+ }
+ \ No newline at end of file
diff --git a/tests/core/test_errar.out b/tests/core/test_errar.out
new file mode 100644
index 00000000..2a042eb1
--- /dev/null
+++ b/tests/core/test_errar.out
@@ -0,0 +1,4 @@
+<Math arg out of domain of func>
+<No more processes>
+<34>
+<123>
diff --git a/tests/test_core.py b/tests/test_core.py
index 7928adee..466ffcc6 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -946,34 +946,10 @@ class T(RunnerCore): # Short name, to make it more fun to use manually on the co
self.do_run_from_file(src, output)
def test_errar(self):
- src = r'''
- #include <stdio.h>
- #include <errno.h>
- #include <string.h>
-
- int main() {
- char* err;
- char buffer[200];
-
- err = strerror(EDOM);
- strerror_r(EWOULDBLOCK, buffer, 200);
- printf("<%s>\n", err);
- printf("<%s>\n", buffer);
-
- printf("<%d>\n", strerror_r(EWOULDBLOCK, buffer, 0));
- errno = 123;
- printf("<%d>\n", errno);
+ test_path = path_from_root('tests', 'core', 'test_errar')
+ src, output = (test_path + s for s in ('.in', '.out'))
- return 0;
- }
- '''
- expected = '''
- <Math arg out of domain of func>
- <No more processes>
- <34>
- <123>
- '''
- self.do_run(src, re.sub('(^|\n)\s+', '\\1', expected))
+ self.do_run_from_file(src, output)
def test_mainenv(self):
src = '''