summaryrefslogtreecommitdiff
path: root/test/LEX
diff options
context:
space:
mode:
authorWilliam Blevins <wblevins001@gmail.com>2016-10-03 02:08:04 -0400
committerWilliam Blevins <wblevins001@gmail.com>2016-10-03 02:08:04 -0400
commit19a22ecca5a72d9f78c0bc8672e5bbe6f11e65c8 (patch)
tree22bf17e710505ff6f6bcf5cc4aa7badfc958d5f2 /test/LEX
parentfd8260b1ea1ec158bcabc8030d3a47eadf7c1255 (diff)
downloadscons-19a22ecca5a72d9f78c0bc8672e5bbe6f11e65c8.tar.gz
Moved common my<xxx>.py functions to global fixture and resolve byte/str.
Diffstat (limited to 'test/LEX')
-rw-r--r--test/LEX/LEXCOM.py16
-rw-r--r--test/LEX/LEXCOMSTR.py16
2 files changed, 4 insertions, 28 deletions
diff --git a/test/LEX/LEXCOM.py b/test/LEX/LEXCOM.py
index 6a323881..75f21b76 100644
--- a/test/LEX/LEXCOM.py
+++ b/test/LEX/LEXCOM.py
@@ -34,21 +34,11 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-
-
-test.write('mylex.py', """
-import sys
-outfile = open(sys.argv[1], 'wb')
-for f in sys.argv[2:]:
- infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != b'/*lex*/\\n']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture('mycompile.py')
test.write('SConstruct', """
env = Environment(tools=['default', 'lex'],
- LEXCOM = r'%(_python_)s mylex.py $TARGET $SOURCES')
+ LEXCOM = r'%(_python_)s mycompile.py lex $TARGET $SOURCES')
env.CFile(target = 'aaa', source = 'aaa.l')
env.CFile(target = 'bbb', source = 'bbb.lex')
""" % locals())
@@ -61,8 +51,6 @@ test.run(arguments = '.')
test.must_match('aaa.c', "aaa.l\n")
test.must_match('bbb.c', "bbb.lex\n")
-
-
test.pass_test()
# Local Variables:
diff --git a/test/LEX/LEXCOMSTR.py b/test/LEX/LEXCOMSTR.py
index 07e693cc..2130d604 100644
--- a/test/LEX/LEXCOMSTR.py
+++ b/test/LEX/LEXCOMSTR.py
@@ -35,21 +35,11 @@ _python_ = TestSCons._python_
test = TestSCons.TestSCons()
-
-
-test.write('mylex.py', """
-import sys
-outfile = open(sys.argv[1], 'wb')
-for f in sys.argv[2:]:
- infile = open(f, 'rb')
- for l in [l for l in infile.readlines() if l != b'/*lex*/\\n']:
- outfile.write(l)
-sys.exit(0)
-""")
+test.file_fixture('mycompile.py')
test.write('SConstruct', """
env = Environment(tools=['default', 'lex'],
- LEXCOM = r'%(_python_)s mylex.py $TARGET $SOURCES',
+ LEXCOM = r'%(_python_)s mycompile.py lex $TARGET $SOURCES',
LEXCOMSTR = 'Lexing $TARGET from $SOURCE')
env.CFile(target = 'aaa', source = 'aaa.l')
env.CFile(target = 'bbb', source = 'bbb.lex')
@@ -66,8 +56,6 @@ Lexing bbb.c from bbb.lex
test.must_match('aaa.c', "aaa.l\n")
test.must_match('bbb.c', "bbb.lex\n")
-
-
test.pass_test()
# Local Variables: