test = TestSCons.TestSCons()
-test.subdir('work1', 'work2')
+test.subdir('work1', 'work2', 'work3')
+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()