aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-07-14 01:46:44 +0300
committermax99x <max99x@gmail.com>2011-07-14 01:46:44 +0300
commitf1507e847df81ff018d43e41c4382aea2361d065 (patch)
tree5cf3145d497e0e5a2ffa23966ad6d6c56f35e256 /tests
parent3c07ebaefda5c70d5014ceaa5d7cf2a3e65e9316 (diff)
Added errno and glibc-defined error codes; implemented strerror().
Diffstat (limited to 'tests')
-rw-r--r--tests/runner.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/runner.py b/tests/runner.py
index 797b78f9..7077fe8a 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -677,6 +677,33 @@ if 'benchmark' not in sys.argv:
'''
self.do_test(src, '3:10,177,543\n4\nwowie\ntoo\n76\n5\n(null)\n/* a comment */\n// another', ['wowie', 'too', '74'])
+ def test_error(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));
+
+ return 0;
+ }
+ '''
+ expected = '''
+ <Numerical argument out of domain>
+ <Resource temporarily unavailable>
+ <34>
+ '''
+ self.do_test(src, re.sub('(^|\n)\s+', '\\1', expected))
+
def test_mainenv(self):
src = '''
#include <stdio.h>