summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Moody <dmoody256@gmail.com>2020-05-19 21:14:41 (GMT)
committerDaniel Moody <dmoody256@gmail.com>2020-05-19 21:14:41 (GMT)
commitdeacd0898818a0358fc29e0edff387acda5b7bc5 (patch)
treea15175a28b7421b91f1d186add82611c515e06a7
parent61d3aba3fdc7d004027a72e961d6db5035956280 (diff)
downloadSCons-deacd0898818a0358fc29e0edff387acda5b7bc5.zip
SCons-deacd0898818a0358fc29e0edff387acda5b7bc5.tar.gz
SCons-deacd0898818a0358fc29e0edff387acda5b7bc5.tar.bz2
used fixtures in test TypeError test
-rw-r--r--test/Subst/TypeError.py32
-rw-r--r--test/Subst/fixture/SConstruct.callable_exception11
2 files changed, 15 insertions, 28 deletions
diff --git a/test/Subst/TypeError.py b/test/Subst/TypeError.py
index b288961..c52434f 100644
--- a/test/Subst/TypeError.py
+++ b/test/Subst/TypeError.py
@@ -85,36 +85,12 @@ expect = expect_build % (r' \[foo\.bar\]', r'\$\{func\(1\)\}')
test.run(status=2, stderr=expect)
-# callable exceptions:
-test.write('foo.c', """\
-#include <stdio.h>
-#include <stdlib.h>
-int
-main(int argc, char *argv[])
-{
- argv[argc++] = "--";
- printf("foo.c");
- exit (0);
-}
-""")
-
-test.write('SConstruct', """\
-
-class TestCallable(object):
- def __init__(self, thing, makePathsRelative = True, debug = False):
- pass
- def __call__(self, target, source, env, for_signature):
- raise TypeError("User callable exception")
-
-env = Environment()
-env["TESTCLASS"] = TestCallable
-env["CCCOM"] = "$CC $_CCCOMCOM $CCFLAGS -o ${TESTCLASS('$TARGET')} -c ${TESTCLASS('$SOURCES')}"
-
-env.Program(target='foo', source='foo.c')
-""")
+# user callable exceptions (Github issue #3654):
+test.file_fixture('test_main.c')
+test.file_fixture('./fixture/SConstruct.callable_exception', 'SConstruct')
test.run(status=2, stderr=r'.*TypeError\s:\sUser\scallable\sexception.*')
-print(test.stdout())
+
test.pass_test()
# Local Variables:
diff --git a/test/Subst/fixture/SConstruct.callable_exception b/test/Subst/fixture/SConstruct.callable_exception
new file mode 100644
index 0000000..3f1b337
--- /dev/null
+++ b/test/Subst/fixture/SConstruct.callable_exception
@@ -0,0 +1,11 @@
+class TestCallable(object):
+ def __init__(self, thing, makePathsRelative = True, debug = False):
+ pass
+ def __call__(self, target, source, env, for_signature):
+ raise TypeError("User callable exception")
+
+env = Environment()
+env["TESTCLASS"] = TestCallable
+env["CCCOM"] = "$CC $_CCCOMCOM $CCFLAGS -o ${TESTCLASS('$TARGET')} -c ${TESTCLASS('$SOURCES')}"
+
+env.Program(target='test_main', source='test_main.c') \ No newline at end of file