summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2003-10-13 13:20:28 (GMT)
committerSteven Knight <knight@baldmt.com>2003-10-13 13:20:28 (GMT)
commitcc0afd7c6d7b051c440eb92c3bfa40142925811e (patch)
treed3dd96c9b87047e6c7d4087f17b6749079b7f1a1 /test
parentcbb331ea63305207c070c77a7c7403d23b049f9d (diff)
downloadSCons-cc0afd7c6d7b051c440eb92c3bfa40142925811e.zip
SCons-cc0afd7c6d7b051c440eb92c3bfa40142925811e.tar.gz
SCons-cc0afd7c6d7b051c440eb92c3bfa40142925811e.tar.bz2
More Environment method conversions:
Diffstat (limited to 'test')
-rw-r--r--test/Alias.py2
-rw-r--r--test/Configure.py14
-rw-r--r--test/Scanner.py33
-rw-r--r--test/Value.py2
4 files changed, 42 insertions, 9 deletions
diff --git a/test/Alias.py b/test/Alias.py
index ea94652..2a14c02 100644
--- a/test/Alias.py
+++ b/test/Alias.py
@@ -54,7 +54,7 @@ SConscript('sub2/SConscript', "env")
foo = Alias('foo')
foo2 = env.Alias('foo', ['f2.out', 'sub1'])
assert foo == foo2
-bar = env.Alias('bar', ['sub2', 'f3.out'])
+bar = Alias('bar', ['sub2', 'f3.out'])
env.Alias('blat', ['sub2', 'f3.out'])
env.Alias('blat', ['f2.out', 'sub1'])
env.Depends('f1.out', 'bar')
diff --git a/test/Configure.py b/test/Configure.py
index 3bad086..9170469 100644
--- a/test/Configure.py
+++ b/test/Configure.py
@@ -116,7 +116,7 @@ Checking for C++ header file vector... yes
env = Environment()
import os
env['ENV']['PATH'] = os.environ['PATH']
-conf = Configure(env)
+conf = env.Configure()
r1 = conf.CheckCHeader( 'no_std_c_header.h' ) # leads to compile error
r2 = conf.CheckLib( 'no_c_library_SAFFDG' ) # leads to link error
env = conf.Finish()
@@ -182,11 +182,11 @@ Checking for C header file no_std_c_header.h... no
test.write( 'SConstruct', """
-env = Environment()
+env = Environment(LOGFILE='build/config.log')
import os
env['ENV']['PATH'] = os.environ['PATH']
BuildDir( 'build', '.' )
-conf = Configure(env, conf_dir='build/config.tests', log_file='build/config.log')
+conf = env.Configure(conf_dir='build/config.tests', log_file='$LOGFILE')
r1 = conf.CheckCHeader( 'math.h' )
r2 = conf.CheckCHeader( 'no_std_c_header.h' ) # leads to compile error
env = conf.Finish()
@@ -243,11 +243,15 @@ def CustomTest(context):
context.Result(ret)
return ret
-env = Environment()
+env = Environment(FOO='fff')
env.Append( CPPPATH='local' )
import os
env['ENV']['PATH'] = os.environ['PATH']
-conf = Configure( env, custom_tests = {'CustomTest' : CustomTest} )
+conf = Configure( env, custom_tests = {'CustomTest' : CustomTest,
+ '$FOO' : CustomTest} )
+if hasattr(conf, 'fff'):
+ conf.Message('$FOO should not have been expanded!')
+ Exit(1)
if not conf.CheckCHeader( 'math.h' ):
Exit(1)
if conf.CheckCHeader( 'no_std_c_header.h' ):
diff --git a/test/Scanner.py b/test/Scanner.py
index 42ef18d..b11805e 100644
--- a/test/Scanner.py
+++ b/test/Scanner.py
@@ -70,15 +70,29 @@ kscan = Scanner(name = 'kfile',
function = kfile_scan,
argument = None,
skeys = ['.k'])
+
+env = Environment(K2SCAN=kfile_scan)
+
+k2scan = env.Scanner(name = 'k2',
+ # We'd like to do the following, but it will take
+ # some major surgery to subst() and subst_list(),
+ # so comment it out for now.
+ # function = '$K2SCAN',
+ function = kfile_scan,
+ argument = None,
+ skeys = ['.k2'])
+
scanners = Environment().Dictionary('SCANNERS')
-env = Environment(SCANNERS = scanners + [kscan])
+env = Environment(SCANNERS = scanners + [kscan, k2scan])
env.Command('foo', 'foo.k', r'%s build.py $SOURCES $TARGET')
+env.Command('junk', 'junk.k2', r'%s build.py $SOURCES $TARGET')
+
bar_in = File('bar.in')
env.Command('bar', bar_in, r'%s build.py $SOURCES $TARGET')
bar_in.source_scanner = kscan
-""" % (python, python))
+""" % (python, python, python))
test.write('foo.k',
"""foo.k 1 line 1
@@ -94,6 +108,13 @@ bar.in 1 line 3
include zzz
""")
+test.write('junk.k2',
+"""include yyy
+junk.k2 1 line 2
+junk.k2 1 line 3
+include zzz
+""")
+
test.write('xxx', "xxx 1\n")
test.write('yyy', "yyy 1\n")
@@ -106,6 +127,8 @@ test.fail_test(test.read('foo') != "foo.k 1 line 1\nxxx 1\nyyy 1\nfoo.k 1 line 4
test.fail_test(test.read('bar') != "yyy 1\nbar.in 1 line 2\nbar.in 1 line 3\nzzz 1\n")
+test.fail_test(test.read('junk') != "yyy 1\njunk.k2 1 line 2\njunk.k2 1 line 3\nzzz 1\n")
+
test.up_to_date(arguments = '.')
test.write('xxx', "xxx 2\n")
@@ -116,6 +139,8 @@ test.fail_test(test.read('foo') != "foo.k 1 line 1\nxxx 2\nyyy 1\nfoo.k 1 line 4
test.fail_test(test.read('bar') != "yyy 1\nbar.in 1 line 2\nbar.in 1 line 3\nzzz 1\n")
+test.fail_test(test.read('junk') != "yyy 1\njunk.k2 1 line 2\njunk.k2 1 line 3\nzzz 1\n")
+
test.write('yyy', "yyy 2\n")
test.run(arguments = '.')
@@ -124,6 +149,8 @@ test.fail_test(test.read('foo') != "foo.k 1 line 1\nxxx 2\nyyy 2\nfoo.k 1 line 4
test.fail_test(test.read('bar') != "yyy 2\nbar.in 1 line 2\nbar.in 1 line 3\nzzz 1\n")
+test.fail_test(test.read('junk') != "yyy 2\njunk.k2 1 line 2\njunk.k2 1 line 3\nzzz 1\n")
+
test.write('zzz', "zzz 2\n")
test.run(arguments = '.')
@@ -132,6 +159,8 @@ test.fail_test(test.read('foo') != "foo.k 1 line 1\nxxx 2\nyyy 2\nfoo.k 1 line 4
test.fail_test(test.read('bar') != "yyy 2\nbar.in 1 line 2\nbar.in 1 line 3\nzzz 2\n")
+test.fail_test(test.read('junk') != "yyy 2\njunk.k2 1 line 2\njunk.k2 1 line 3\nzzz 2\n")
+
test.up_to_date(arguments = 'foo')
test.pass_test()
diff --git a/test/Value.py b/test/Value.py
index 11fb72a..5f723bf 100644
--- a/test/Value.py
+++ b/test/Value.py
@@ -54,7 +54,7 @@ def create(target, source, env):
env = Environment()
env['BUILDERS']['B'] = Builder(action = create)
env.B('f1.out', Value(P))
-env.B('f2.out', Value(L))
+env.B('f2.out', env.Value(L))
env.B('f3.out', Value(C))
""" % source_signature)