diff options
-rw-r--r-- | lib/spack/spack/test/spec_syntax.py | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/spack/spack/test/spec_syntax.py b/lib/spack/spack/test/spec_syntax.py index dfad4a019f..2ee9ef486c 100644 --- a/lib/spack/spack/test/spec_syntax.py +++ b/lib/spack/spack/test/spec_syntax.py @@ -138,6 +138,13 @@ class TestSpecSyntax(object): self.check_parse("^zlib") self.check_parse("+foo") self.check_parse("arch=test-None-None", "platform=test") + self.check_parse('@2.7:') + + @pytest.mark.xfail() + def test_anonymous_specs_with_multiple_parts(self): + # Parse anonymous spec with multiple tokens + self.check_parse('languages=go @4.2:') + self.check_parse('@4.2: languages=go') def test_simple_dependence(self): self.check_parse("openmpi^hwloc") @@ -539,3 +546,22 @@ class TestSpecSyntax(object): "mvapich_foo debug= 4 " "^ _openmpi @1.2 : 1.4 , 1.6 % intel @ 12.1 : 12.6 + debug - qt_4 " "^ stackwalker @ 8.1_1e") + + +@pytest.mark.parametrize('spec,anon_spec,spec_name', [ + ('openmpi languages=go', 'languages=go', 'openmpi'), + ('openmpi @4.6:', '@4.6:', 'openmpi'), + pytest.mark.xfail( + ('openmpi languages=go @4.6:', 'languages=go @4.6:', 'openmpi') + ), + pytest.mark.xfail( + ('openmpi @4.6: languages=go', '@4.6: languages=go', 'openmpi') + ), +]) +def test_parse_anonymous_specs(spec, anon_spec, spec_name): + + expected = parse(spec) + spec = parse_anonymous_spec(anon_spec, spec_name) + + assert len(expected) == 1 + assert spec in expected |