Add a test to make sure we can Add{Pre,Post}Action() on Dir Nodes.
authorstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 3 Dec 2004 04:16:16 +0000 (04:16 +0000)
committerstevenknight <stevenknight@fdb21ef1-2011-0410-befe-b5e4ea1792b1>
Fri, 3 Dec 2004 04:16:16 +0000 (04:16 +0000)
git-svn-id: http://scons.tigris.org/svn/scons/trunk@1180 fdb21ef1-2011-0410-befe-b5e4ea1792b1

test/pre-post-actions.py

index d0e8084a5902083e0c037790a4f3d2734cf906a4..860ae24cc957384125b7e0014233a368d89fcb4d 100644 (file)
@@ -36,7 +36,7 @@ _exe = TestSCons._exe
 
 test = TestSCons.TestSCons()
 
-test.subdir('work1', 'work2')
+test.subdir('work1', 'work2', 'work3')
 
 
 
@@ -146,4 +146,27 @@ test.must_match(['work2', 'file3.out'], "333\n")
 
 
 
+test.write(['work3', 'SConstruct'], """\
+def pre(target, source, env):
+    pass
+def post(target, source, env):
+    pass
+def build(target, source, env):
+    open(str(target[0]), 'wb').write('build()\\n')
+env = Environment()
+AddPreAction('dir', pre)
+AddPostAction('dir', post)
+env.Command('dir/file', [], build)
+""")
+
+test.run(chdir = 'work3', arguments = 'dir/file', stdout=test.wrap_stdout("""\
+pre(["dir"], [])
+post(["dir"], [])
+build(["dir/file"], [])
+"""))
+
+test.must_match(['work3', 'dir', 'file'], "build()\n")
+
+
+
 test.pass_test()