diff options
author | Steven Knight <knight@baldmt.com> | 2001-12-20 04:40:12 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2001-12-20 04:40:12 (GMT) |
commit | 8526ba0bb9938ddf3ceca8ca917c77f7b1505f55 (patch) | |
tree | 724169956a0e4bef7a271ad4b46d8dca4cee3d2b /test | |
parent | 98bdd799b0c61d2bf1004a9dc39976e4a31abc9c (diff) | |
download | SCons-8526ba0bb9938ddf3ceca8ca917c77f7b1505f55.zip SCons-8526ba0bb9938ddf3ceca8ca917c77f7b1505f55.tar.gz SCons-8526ba0bb9938ddf3ceca8ca917c77f7b1505f55.tar.bz2 |
Fix Export(), add Import() and Return()
Diffstat (limited to 'test')
-rw-r--r-- | test/CPPPATH.py | 3 | ||||
-rw-r--r-- | test/Depends.py | 3 | ||||
-rw-r--r-- | test/SConscript.py | 91 | ||||
-rw-r--r-- | test/actions.py | 2 | ||||
-rw-r--r-- | test/errors.py | 12 |
5 files changed, 105 insertions, 6 deletions
diff --git a/test/CPPPATH.py b/test/CPPPATH.py index aa75019..fb21426 100644 --- a/test/CPPPATH.py +++ b/test/CPPPATH.py @@ -46,10 +46,11 @@ test.write('SConstruct', """ env = Environment(CPPPATH = ['include']) obj = env.Object(target='prog', source='subdir/prog.c') env.Program(target='prog', source=obj) -SConscript('subdir/SConscript', Export(env=env)) +SConscript('subdir/SConscript', "env") """) test.write(['subdir', 'SConscript'], """ +Import("env") env.Program(target='prog', source='prog.c') """) diff --git a/test/Depends.py b/test/Depends.py index ab045ae..1ccf7f4 100644 --- a/test/Depends.py +++ b/test/Depends.py @@ -52,10 +52,11 @@ env.Depends(target = 'f3.out', dependency = 'subdir/bar.dep') env.Foo(target = 'f1.out', source = 'f1.in') env.Foo(target = 'f2.out', source = 'f2.in') env.Bar(target = 'f3.out', source = 'f3.in') -SConscript('subdir/SConscript', Export(env=env)) +SConscript('subdir/SConscript', "env") """ % (python, python)) test.write(['subdir', 'SConscript'], """ +Import("env") env.Depends(target = 'f4.out', dependency = 'bar.dep') env.Bar(target = 'f4.out', source = 'f4.in') """) diff --git a/test/SConscript.py b/test/SConscript.py index b463f7e..5172040 100644 --- a/test/SConscript.py +++ b/test/SConscript.py @@ -30,16 +30,105 @@ test = TestSCons.TestSCons() test.write('SConstruct', """ import os + print "SConstruct", os.getcwd() SConscript('SConscript') + +x1 = "SConstruct x1" +x2 = "SConstruct x2" +x3,x4 = SConscript('SConscript1', "x1 x2") +assert x3 == "SConscript1 x3" +assert x4 == "SConscript1 x4" + + +(x3,x4) = SConscript('SConscript2', ["x1","x2"]) +assert x3 == "SConscript2 x3" +assert x4 == "SConscript2 x4" + +Export("x1 x2") +SConscript('SConscript3') +Import("x1 x2") +assert x1 == "SConscript3 x1" +assert x2 == "SConscript3 x2" + +x1 = "SConstruct x1" +x2 = "SConstruct x2" +Export("x1","x2") +SConscript('SConscript4') +Import("x1"," x2") +assert x1 == "SConscript4 x1" +assert x2 == "SConscript4 x2" + """) -# XXX I THINK THEY SHOULD HAVE TO RE-IMPORT OS HERE test.write('SConscript', """ + +# os should not be automajically imported: +assert not globals().has_key("os") + import os print "SConscript " + os.getcwd() """) +test.write('SConscript1', """ +Import("x1 x2") +assert x1 == "SConstruct x1" +assert x2 == "SConstruct x2" + +x3 = "SConscript1 x3" +x4 = "SConscript1 x4" +Return("x3 x4") +""") + + + +test.write('SConscript2', """ +Import("x1","x2") +assert x1 == "SConstruct x1" +assert x2 == "SConstruct x2" +x3 = "SConscript2 x3" +x4 = "SConscript2 x4" +Return("x3","x4") +""") + +test.write('SConscript3', """ +Import("x1 x2") +assert x1 == "SConstruct x1" +assert x2 == "SConstruct x2" +x1 = "SConscript3 x1" +x2 = "SConscript3 x2" + +x5 = SConscript('SConscript31', "x1") +Import("x6") +assert x5 == "SConscript31 x5" +assert x6 == "SConscript31 x6" + +Export("x1 x2") + + +""") + +test.write('SConscript31', """ +Import("x1 x2") +assert x1 == "SConscript3 x1" +assert x2 == "SConstruct x2" +x5 = "SConscript31 x5" +x6 = "SConscript31 x6" +Export("x6") +Return("x5") +""") + + +test.write('SConscript4', """ +Import("x1", "x2") +assert x1 == "SConstruct x1" +assert x2 == "SConstruct x2" +x1 = "SConscript4 x1" +x2 = "SConscript4 x2" +Export("x1", "x2") +""") + + wpath = test.workpath() test.run(stdout = "SConstruct %s\nSConscript %s\n" % (wpath, wpath)) diff --git a/test/actions.py b/test/actions.py index 9ba689b..fca14bd 100644 --- a/test/actions.py +++ b/test/actions.py @@ -86,6 +86,8 @@ test.up_to_date(arguments = '.') test.write('SConstruct', """ import os +assert not globals().has_key('string') +import string class bld: def __init__(self): self.cmd = r'%s build.py %%s 4 %%s' diff --git a/test/errors.py b/test/errors.py index 5edd8f9..cb2248d 100644 --- a/test/errors.py +++ b/test/errors.py @@ -47,17 +47,21 @@ SyntaxError: invalid syntax test.write('SConstruct2', """ -raise UserError, 'Depends() require both sources and targets.' +assert not globals().has_key("UserError") +import SCons.Errors +raise SCons.Errors.UserError, 'Depends() require both sources and targets.' """) test.run(arguments='-f SConstruct2', stdout = "", stderr = """ SCons error: Depends\(\) require both sources and targets. -File "SConstruct2", line 2, in \? +File "SConstruct2", line 4, in \? """) test.write('SConstruct3', """ +assert not globals().has_key("InternalError") +from SCons.Errors import InternalError raise InternalError, 'error inside' """) @@ -67,7 +71,9 @@ test.run(arguments='-f SConstruct3', File ".*Script.py", line \d+, in main _main\(\) File ".*Script.py", line \d+, in _main - exec file in script_env + SCons.SConscript.SConscript\(script\) + File ".*SConscript.py", line \d+, in SConscript + exec file in stack\[-1\].globals File "SConstruct3", line \d+, in \? raise InternalError, 'error inside' InternalError: error inside |