SCons / test /

Diff from to

File test/

 __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
-Verify that we can trivially subclass our "public" classes.
+Verify that we can trivially subclass our "public" classes.  Also
+verify that we can use a trivial subclass of new-style str classes
+as well as UserString as Builder input.
 import TestSCons
 test = TestSCons.TestSCons()
 test.write('SConstruct', """
+copy_action = Copy('$TARGET', '$SOURCE')
 # Some day, we'd probably like people to be able to subclass Action and
 # Builder, but that's going to take some serious class-hackery to turn
 # our factory function into the class itself.
 class my_Environment(Environment):
 env = my_Environment()
-env.Program('hello', 'hello.c')
+env.Command('f0.out', '', copy_action)
+from UserString import UserString
+    class mystr(str):
+        pass
+except TypeError:
+    class mystr(UserString):
+        pass
+Command(mystr('f1.out'),        mystr(''), copy_action)
+Command(UserString('f2.out'),   UserString(''),    copy_action)
+Install(mystr('install'),       mystr('f1.out'))
+Install(mystr('install'),       UserString('f2.out'))
-test.write('hello.c', """\
-#include <stdio.h>
-#include <stdlib.h>
-main(int argc, char *argv[]) {
-    printf("hello.c\\n");
+test.write('', "\n")
+test.write('', "\n")
+test.write('', "\n") = '.')
+test.must_match('f0.out',              "\n")
+test.must_match(['install', 'f1.out'], "\n")
+test.must_match(['install', 'f2.out'], "\n")