diff options
Diffstat (limited to 'test/CPPDEFINES.py')
-rw-r--r-- | test/CPPDEFINES.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/CPPDEFINES.py b/test/CPPDEFINES.py index b8e08f8..50b6abd 100644 --- a/test/CPPDEFINES.py +++ b/test/CPPDEFINES.py @@ -78,10 +78,12 @@ test.run(arguments = '.', stdout=expect) test.write('SConstruct', """\ foo = Environment(CPPDEFINES = ['FOO', ('VAL', 7)]) bar = Environment(CPPDEFINES = {'BAR':None, 'VAL':8}) +baz = Environment(CPPDEFINES = ['BAZ', ('VAL', 9)]) f = foo.Object(target = 'foo', source = 'prog.c') b = bar.Object(target = 'bar', source = 'prog.c') foo.Program(target = 'foo', source = f) bar.Program(target = 'bar', source = b) +baz.Program(target = 'baz', source = 'baz.cpp') """) test.write('prog.c', r""" @@ -99,10 +101,24 @@ main(int argc, char *argv[]) } """) +test.write('baz.cpp', r"""\ +#include <stdio.h> +#include <stdlib.h> +int +main(int argc, char *argv[]) +{ +#ifdef BAZ + printf("baz.cpp: BAZ %d\n", VAL); +#endif + return(0); +} +""") + test.run(arguments = '.') test.run(program = test.workpath('foo'), stdout = "prog.c: FOO 7\n") test.run(program = test.workpath('bar'), stdout = "prog.c: BAR 8\n") +test.run(program = test.workpath('baz'), stdout = "baz.cpp: BAZ 9\n") test.pass_test() |