diff options
author | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-04-06 17:19:51 +0900 |
---|---|---|
committer | Tristan Van Berkom <tristan.vanberkom@codethink.co.uk> | 2018-04-06 17:36:42 +0900 |
commit | a2bc2a1c252e9cb6e7ca05ff8ff67269239e38f5 (patch) | |
tree | f4590fe1df34a057186d3358891dc9d9daabfdca /tests/format | |
parent | c2500610996c27ab5c7f8408a517e45102939674 (diff) | |
download | buildstream-a2bc2a1c252e9cb6e7ca05ff8ff67269239e38f5.tar.gz |
tests/format/options.py: Added tests for invalid option name symbols
Diffstat (limited to 'tests/format')
9 files changed, 45 insertions, 0 deletions
diff --git a/tests/format/options.py b/tests/format/options.py index 9408ae5cc..b537fdfbf 100644 --- a/tests/format/options.py +++ b/tests/format/options.py @@ -12,6 +12,19 @@ DATA_DIR = os.path.join( @pytest.mark.datafiles(DATA_DIR) +@pytest.mark.parametrize("project_dir", [ + ('invalid-name-spaces'), + ('invalid-name-dashes'), + ('invalid-name-plus'), + ('invalid-name-leading-number'), +]) +def test_invalid_option_name(cli, datafiles, project_dir): + project = os.path.join(datafiles.dirname, datafiles.basename, project_dir) + result = cli.run(project=project, silent=True, args=['show', 'element.bst']) + result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_SYMBOL_NAME) + + +@pytest.mark.datafiles(DATA_DIR) def test_invalid_option_type(cli, datafiles): project = os.path.join(datafiles.dirname, datafiles.basename, 'invalid-type') diff --git a/tests/format/options/invalid-name-dashes/element.bst b/tests/format/options/invalid-name-dashes/element.bst new file mode 100644 index 000000000..3c29b4ea1 --- /dev/null +++ b/tests/format/options/invalid-name-dashes/element.bst @@ -0,0 +1 @@ +kind: autotools diff --git a/tests/format/options/invalid-name-dashes/project.conf b/tests/format/options/invalid-name-dashes/project.conf new file mode 100644 index 000000000..045ce564f --- /dev/null +++ b/tests/format/options/invalid-name-dashes/project.conf @@ -0,0 +1,7 @@ +name: test + +options: + name-with-dashes: + type: bool + description: An invalid option name + default: False diff --git a/tests/format/options/invalid-name-leading-number/element.bst b/tests/format/options/invalid-name-leading-number/element.bst new file mode 100644 index 000000000..3c29b4ea1 --- /dev/null +++ b/tests/format/options/invalid-name-leading-number/element.bst @@ -0,0 +1 @@ +kind: autotools diff --git a/tests/format/options/invalid-name-leading-number/project.conf b/tests/format/options/invalid-name-leading-number/project.conf new file mode 100644 index 000000000..bb3e2ef6d --- /dev/null +++ b/tests/format/options/invalid-name-leading-number/project.conf @@ -0,0 +1,7 @@ +name: test + +options: + 123number_is_first: + type: bool + description: An invalid option name + default: False diff --git a/tests/format/options/invalid-name-plus/element.bst b/tests/format/options/invalid-name-plus/element.bst new file mode 100644 index 000000000..3c29b4ea1 --- /dev/null +++ b/tests/format/options/invalid-name-plus/element.bst @@ -0,0 +1 @@ +kind: autotools diff --git a/tests/format/options/invalid-name-plus/project.conf b/tests/format/options/invalid-name-plus/project.conf new file mode 100644 index 000000000..d62869e73 --- /dev/null +++ b/tests/format/options/invalid-name-plus/project.conf @@ -0,0 +1,7 @@ +name: test + +options: + name_with_+: + type: bool + description: An invalid option name + default: False diff --git a/tests/format/options/invalid-name-spaces/element.bst b/tests/format/options/invalid-name-spaces/element.bst new file mode 100644 index 000000000..3c29b4ea1 --- /dev/null +++ b/tests/format/options/invalid-name-spaces/element.bst @@ -0,0 +1 @@ +kind: autotools diff --git a/tests/format/options/invalid-name-spaces/project.conf b/tests/format/options/invalid-name-spaces/project.conf new file mode 100644 index 000000000..66931e28c --- /dev/null +++ b/tests/format/options/invalid-name-spaces/project.conf @@ -0,0 +1,7 @@ +name: test + +options: + name with spaces: + type: bool + description: An invalid option name + default: False |