diff options
author | Mats Wichmann <mats@linux.com> | 2024-08-27 16:21:54 (GMT) |
---|---|---|
committer | Mats Wichmann <mats@linux.com> | 2024-08-27 16:43:03 (GMT) |
commit | aca5728fd680cca0182b5873b6d34fcd9f6f2821 (patch) | |
tree | 0641c39134abf5ba07e0623efe7d5305f3d04c5b /test | |
parent | 6cf21b8298d81fa34f583b60d3fd19a4201d8a04 (diff) | |
download | SCons-aca5728fd680cca0182b5873b6d34fcd9f6f2821.zip SCons-aca5728fd680cca0182b5873b6d34fcd9f6f2821.tar.gz SCons-aca5728fd680cca0182b5873b6d34fcd9f6f2821.tar.bz2 |
Variables testing: confirm space-containing values
The previous commit introduced a change to how the framework handled
arguments, which necessitated some changes in the variables code.
It got too complicated, too many places would need too much logic.
Just accept that the test.run(arguments="...") will never be quite
like the same arguments on the CLI, and just use lists to avoid
things being broken on embedded spaces - those won't be split.
Many tests arleady do this, so it's nothing new. Added a comment
in TestCmd to make it more clear.
Signed-off-by: Mats Wichmann <mats@linux.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/Variables/EnumVariable.py | 9 | ||||
-rw-r--r-- | test/Variables/PackageVariable.py | 5 | ||||
-rw-r--r-- | test/Variables/PathVariable.py | 20 |
3 files changed, 27 insertions, 7 deletions
diff --git a/test/Variables/EnumVariable.py b/test/Variables/EnumVariable.py index a81e806..48f2408 100644 --- a/test/Variables/EnumVariable.py +++ b/test/Variables/EnumVariable.py @@ -52,8 +52,8 @@ opts.AddVariables( allowed_values=('motif', 'gtk', 'kde'), map={}, ignorecase=1), # case insensitive EV('some', 'some option', 'xaver', - allowed_values=('xaver', 'eins'), - map={}, ignorecase=2), # make lowercase + allowed_values=('xaver', 'eins', 'zwei wörter'), + map={}, ignorecase=2), # case lowering ) _ = DefaultEnvironment(tools=[]) @@ -89,11 +89,14 @@ scons: *** Invalid value for enum variable 'guilib': 'irgendwas'. Valid values a test.run(arguments='guilib=IrGeNdwas', stderr=expect_stderr, status=2) expect_stderr = """ -scons: *** Invalid value for enum variable 'some': 'irgendwas'. Valid values are: ('xaver', 'eins') +scons: *** Invalid value for enum variable 'some': 'irgendwas'. Valid values are: ('xaver', 'eins', 'zwei wörter') """ + test.python_file_line(SConstruct_path, 20) test.run(arguments='some=IrGeNdwas', stderr=expect_stderr, status=2) +test.run(arguments=['some=zwei Wörter']) +check(['no', 'gtk', 'zwei wörter']) # case-lowering converter + test.pass_test() # Local Variables: diff --git a/test/Variables/PackageVariable.py b/test/Variables/PackageVariable.py index 64e0fa8..e87164c 100644 --- a/test/Variables/PackageVariable.py +++ b/test/Variables/PackageVariable.py @@ -70,6 +70,11 @@ check([str(False)]) test.run(arguments=['x11=%s' % test.workpath()]) check([test.workpath()]) +space_subdir = test.workpath('space subdir') +test.subdir(space_subdir) +test.run(arguments=[f'x11={space_subdir}']) +check([space_subdir]) + expect_stderr = """ scons: *** Path does not exist for variable 'x11': '/non/existing/path/' """ + test.python_file_line(SConstruct_path, 13) diff --git a/test/Variables/PathVariable.py b/test/Variables/PathVariable.py index effbd49..af9efd3 100644 --- a/test/Variables/PathVariable.py +++ b/test/Variables/PathVariable.py @@ -106,12 +106,19 @@ test.run(arguments=['qt_libraries=%s' % qtpath], stderr=expect_stderr, status=2) default_file = test.workpath('default_file') default_subdir = test.workpath('default_subdir') + existing_subdir = test.workpath('existing_subdir') test.subdir(existing_subdir) existing_file = test.workpath('existing_file') test.write(existing_file, "existing_file\n") +space_subdir = test.workpath('space subdir') +test.subdir(space_subdir) + +space_file = test.workpath('space file') +test.write(space_file, "space_file\n") + non_existing_subdir = test.workpath('non_existing_subdir') non_existing_file = test.workpath('non_existing_file') @@ -135,17 +142,22 @@ 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' % space_file]) +check([space_file]) + +test.run(arguments=['X=%s' % space_subdir]) +check([space_subdir]) + test.run(arguments=['X=%s' % non_existing_subdir]) check([non_existing_subdir]) +test.must_not_exist(non_existing_subdir) +test.run(arguments=['X=%s' % non_existing_file]) +check([non_existing_file]) test.must_not_exist(non_existing_file) -test.must_not_exist(non_existing_subdir) test.write(SConstruct_path, """\ opts = Variables(args=ARGUMENTS) |