diff options
author | Steven Knight <knight@baldmt.com> | 2007-06-01 21:14:13 (GMT) |
---|---|---|
committer | Steven Knight <knight@baldmt.com> | 2007-06-01 21:14:13 (GMT) |
commit | f311f5ac8b8da71b93166bf566aa0a89c91abd50 (patch) | |
tree | 7e913c029bfbdf97ba614bb07f639af5d45ae2ae /src/engine/SCons/EnvironmentTests.py | |
parent | 3978c6205c89626792ff84de70e863967a912aba (diff) | |
download | SCons-f311f5ac8b8da71b93166bf566aa0a89c91abd50.zip SCons-f311f5ac8b8da71b93166bf566aa0a89c91abd50.tar.gz SCons-f311f5ac8b8da71b93166bf566aa0a89c91abd50.tar.bz2 |
Merged revisions 1907-1940,1942-1967 via svnmerge from
http://scons.tigris.org/svn/scons/branches/core
........
r1914 | stevenknight | 2007-05-19 20:18:45 -0700 (Sat, 19 May 2007) | 4 lines
Use the dict() builtin, not a by-hand function, to assemble --debug=explain
info. Update our backwards-compatibility dict() function so its calling
signature matches the later SCons dict() builtin, and so it actually works.
........
r1920 | stevenknight | 2007-05-21 19:59:00 -0700 (Mon, 21 May 2007) | 4 lines
Issue 1652: only add the {base}_p.c and {base}_data.c files if the
/proxy or /dlldata arguments are present (respectively).
(Allan Erskine)
........
r1921 | stevenknight | 2007-05-21 20:09:54 -0700 (Mon, 21 May 2007) | 2 lines
Add initial .svnt/conf file for experimental use.
........
r1924 | stevenknight | 2007-05-22 17:51:34 -0700 (Tue, 22 May 2007) | 3 lines
Don't let tool initialization overwrite ${C,CXX}FILESUFFIX if they're
already set.
........
r1925 | stevenknight | 2007-05-22 19:14:27 -0700 (Tue, 22 May 2007) | 3 lines
Change the --debug=explain message when AlwaysBuild() is set from
the default "unknown reasons" to "because AlwaysBuild() is specified."
........
r1927 | stevenknight | 2007-05-23 05:20:32 -0700 (Wed, 23 May 2007) | 3 lines
Issue 1658: Find Java anonymous classes when the next token after
the name is an open parenthesis. (Jan Nijtmans)
........
r1928 | stevenknight | 2007-05-23 11:50:20 -0700 (Wed, 23 May 2007) | 3 lines
Issue 1313: add support for {Get,Set}Option('help') and
{Get,Set}Option('random') .
........
r1929 | stevenknight | 2007-05-23 11:56:18 -0700 (Wed, 23 May 2007) | 3 lines
Issue 1362: Push/retrieve built symlinks to/from a CacheDir() as symlinks,
not by copying file contents.
........
r1930 | stevenknight | 2007-05-23 12:55:12 -0700 (Wed, 23 May 2007) | 3 lines
Issue 1638: add LaTeX scanner support for finding dependencies from
\usepackage{} directives. (Sohail Somani)
........
r1932 | stevenknight | 2007-05-24 05:06:45 -0700 (Thu, 24 May 2007) | 3 lines
Add a section mentioning that libraries can be built from mixed lists
of source code and object files. (Follow-up from IRC chat.)
........
r1933 | stevenknight | 2007-05-24 11:18:30 -0700 (Thu, 24 May 2007) | 2 lines
Issue 1467: add /opt/SUNWspro/bin to the default execution $PATH on Solaris.
........
r1934 | stevenknight | 2007-05-24 13:10:01 -0700 (Thu, 24 May 2007) | 3 lines
Support running tests when Python is in a path that contains
spaces (like "C:\Program Files\Python...").
........
r1935 | stevenknight | 2007-05-24 13:11:52 -0700 (Thu, 24 May 2007) | 4 lines
Issue 1479: print multiple projects in a Visual Studio 7.[01] solution
file, generating a separate GUID for each instead of re-using the
solution GUID. (Mark Bertoglio)
........
r1937 | stevenknight | 2007-05-26 14:35:17 -0700 (Sat, 26 May 2007) | 4 lines
Issue 1659: when stringifying a generator action, fall back to using
the default construction environment, not an empty dictionary, if not
environment was supplied.
........
r1938 | stevenknight | 2007-05-29 05:14:37 -0700 (Tue, 29 May 2007) | 2 lines
Re-run tests if any of the test infrastructure changed, too.
........
r1940 | stevenknight | 2007-05-29 06:58:42 -0700 (Tue, 29 May 2007) | 2 lines
Issue 1634: "define HAVE_FEATURE 1" lines in generated config.h files.
........
r1943 | stevenknight | 2007-05-29 13:24:34 -0700 (Tue, 29 May 2007) | 2 lines
Issue 1426: Generalize AlwaysBuild() to non-File Nodes.
........
r1945 | stevenknight | 2007-05-30 08:15:25 -0700 (Wed, 30 May 2007) | 3 lines
Clean up emitter unit tests: subdivide one large test case into
separate tests, code renaming and reorganizing for readability.
........
r1947 | stevenknight | 2007-05-30 10:22:49 -0700 (Wed, 30 May 2007) | 4 lines
Issue 1656: two PDB fixes:
1) support expansion of $TARGET, etc. in emitted file names
2) put the output PDB file in the target's build_dir
........
r1951 | stevenknight | 2007-05-31 12:51:42 -0700 (Thu, 31 May 2007) | 3 lines
Refactor the checkLogAndStdout() function into a TestSCons method
so we can split the sub-tests into their own scripts.
........
r1952 | stevenknight | 2007-05-31 13:00:56 -0700 (Thu, 31 May 2007) | 3 lines
Also move the definition of what system library we need to use for
Configure tests into the TestSCons class.
........
r1953 | stevenknight | 2007-05-31 14:12:16 -0700 (Thu, 31 May 2007) | 2 lines
Refactor the Configure context subtests into separate scripts.
........
r1954 | stevenknight | 2007-05-31 14:18:11 -0700 (Thu, 31 May 2007) | 3 lines
Get rid of the work_dir argument to checkLogAndStdout(), since we're
no longer executing sub-tests from separate subdirectories.
........
r1955 | stevenknight | 2007-05-31 14:35:20 -0700 (Thu, 31 May 2007) | 2 lines
Move the test to its correct subdirectory. Oops.
........
r1958 | stevenknight | 2007-06-01 08:35:50 -0700 (Fri, 01 Jun 2007) | 2 lines
Skip the Visual C/C++ PDB + BuildDir test when not run on Windows.
........
r1959 | stevenknight | 2007-06-01 09:35:09 -0700 (Fri, 01 Jun 2007) | 2 lines
Support an AddMethod() global function and construction environment method.
........
r1960 | stevenknight | 2007-06-01 09:52:59 -0700 (Fri, 01 Jun 2007) | 3 lines
Python 1.5 compatibility in the test infrastructure added to support
the refactored Configure tests.
........
r1963 | stevenknight | 2007-06-01 12:29:48 -0700 (Fri, 01 Jun 2007) | 2 lines
Python 1.5 compatibility fix for AddMethod().
........
Diffstat (limited to 'src/engine/SCons/EnvironmentTests.py')
-rw-r--r-- | src/engine/SCons/EnvironmentTests.py | 67 |
1 files changed, 61 insertions, 6 deletions
diff --git a/src/engine/SCons/EnvironmentTests.py b/src/engine/SCons/EnvironmentTests.py index 70f9026..a8b718d 100644 --- a/src/engine/SCons/EnvironmentTests.py +++ b/src/engine/SCons/EnvironmentTests.py @@ -357,6 +357,22 @@ class SubstitutionTestCase(unittest.TestCase): assert not hasattr(nodes[1], 'bbbb'), nodes[0] assert nodes[1].c == 1, nodes[1] + def test_arg2nodes_target_source(self): + """Test the arg2nodes method with target= and source= keywords + """ + targets = [DummyNode('t1'), DummyNode('t2')] + sources = [DummyNode('s1'), DummyNode('s2')] + env = SubstitutionEnvironment() + nodes = env.arg2nodes(['${TARGET}-a', + '${SOURCE}-b', + '${TARGETS[1]}-c', + '${SOURCES[1]}-d'], + DummyNode, + target=targets, + source=sources) + names = map(lambda n: n.name, nodes) + assert names == ['t1-a', 's1-b', 't2-c', 's2-d'], names + def test_gvars(self): """Test the base class gvars() method""" env = SubstitutionEnvironment() @@ -626,6 +642,38 @@ sys.exit(1) finally: sys.stderr = save_stderr + def test_AddMethod(self): + """Test the AddMethod() method""" + env = SubstitutionEnvironment(FOO = 'foo') + + def func(self): + return 'func-' + self['FOO'] + + assert not hasattr(env, 'func') + env.AddMethod(func) + r = env.func() + assert r == 'func-foo', r + + assert not hasattr(env, 'bar') + env.AddMethod(func, 'bar') + r = env.bar() + assert r == 'func-foo', r + + def func2(self, arg=''): + return 'func2-' + self['FOO'] + arg + + env.AddMethod(func2) + r = env.func2() + assert r == 'func2-foo', r + r = env.func2('-xxx') + assert r == 'func2-foo-xxx', r + + env.AddMethod(func2, 'func') + r = env.func() + assert r == 'func2-foo', r + r = env.func('-yyy') + assert r == 'func2-foo-yyy', r + def test_Override(self): "Test overriding construction variables" env = SubstitutionEnvironment(ONE=1, TWO=2, THREE=3, FOUR=4) @@ -2390,22 +2438,29 @@ def generate(env): def test_AlwaysBuild(self): """Test the AlwaysBuild() method""" env = self.TestEnvironment(FOO='fff', BAR='bbb') - t = env.AlwaysBuild('a', 'b$FOO', ['c', 'd'], '$BAR') - assert t[0].__class__.__name__ == 'File' + t = env.AlwaysBuild('a', 'b$FOO', ['c', 'd'], '$BAR', + env.fs.Dir('dir'), env.fs.File('file')) + assert t[0].__class__.__name__ == 'Entry' assert t[0].path == 'a' assert t[0].always_build - assert t[1].__class__.__name__ == 'File' + assert t[1].__class__.__name__ == 'Entry' assert t[1].path == 'bfff' assert t[1].always_build - assert t[2].__class__.__name__ == 'File' + assert t[2].__class__.__name__ == 'Entry' assert t[2].path == 'c' assert t[2].always_build - assert t[3].__class__.__name__ == 'File' + assert t[3].__class__.__name__ == 'Entry' assert t[3].path == 'd' assert t[3].always_build - assert t[4].__class__.__name__ == 'File' + assert t[4].__class__.__name__ == 'Entry' assert t[4].path == 'bbb' assert t[4].always_build + assert t[5].__class__.__name__ == 'Dir' + assert t[5].path == 'dir' + assert t[5].always_build + assert t[6].__class__.__name__ == 'File' + assert t[6].path == 'file' + assert t[6].always_build def test_BuildDir(self): """Test the BuildDir() method""" |