summaryrefslogtreecommitdiffstats
path: root/test/Options
diff options
context:
space:
mode:
authorSteven Knight <knight@baldmt.com>2005-01-03 15:29:43 (GMT)
committerSteven Knight <knight@baldmt.com>2005-01-03 15:29:43 (GMT)
commit49766df7a53c47fdc9d30549595efe1cfcd479b0 (patch)
treef19db2c2638da5a4487384d05caeca4488860f2a /test/Options
parent203974e18ca6869965f194eb07fcdd8ccc8c91c9 (diff)
downloadSCons-49766df7a53c47fdc9d30549595efe1cfcd479b0.zip
SCons-49766df7a53c47fdc9d30549595efe1cfcd479b0.tar.gz
SCons-49766df7a53c47fdc9d30549595efe1cfcd479b0.tar.bz2
Add a PathOptions.PathAccept validator. (Kevin Quick)
Diffstat (limited to 'test/Options')
-rw-r--r--test/Options/PathOption.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/test/Options/PathOption.py b/test/Options/PathOption.py
index 4366730..55f95c5 100644
--- a/test/Options/PathOption.py
+++ b/test/Options/PathOption.py
@@ -119,6 +119,39 @@ non_existing_file = test.workpath('non_existing_file')
test.write('SConstruct', """\
opts = Options(args=ARGUMENTS)
opts.AddOptions(
+ PathOption('X', 'X variable', r'%s', validator=PathOption.PathAccept),
+ )
+
+env = Environment(options=opts)
+
+print env['X']
+
+Default(env.Alias('dummy', None))
+""" % default_subdir)
+
+test.run()
+check([default_subdir])
+
+test.run(arguments='"X=%s"' % existing_file)
+check([existing_file])
+
+test.run(arguments='"X=%s"' % non_existing_file)
+check([non_existing_file])
+
+test.run(arguments='"X=%s"' % existing_subdir)
+check([existing_subdir])
+
+test.run(arguments='"X=%s"' % non_existing_subdir)
+check([non_existing_subdir])
+
+test.must_not_exist(non_existing_file)
+test.must_not_exist(non_existing_subdir)
+
+
+
+test.write('SConstruct', """\
+opts = Options(args=ARGUMENTS)
+opts.AddOptions(
PathOption('X', 'X variable', r'%s', validator=PathOption.PathIsFile),
)