summaryrefslogtreecommitdiff
path: root/tests/format
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-06 17:30:53 +0900
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-06 17:51:16 +0900
commit21050433863a5f470718bd5dbb54a0476e229b30 (patch)
treefbb64a56dddde503bd5986a52ffa9027c89ff09f /tests/format
parenta2bc2a1c252e9cb6e7ca05ff8ff67269239e38f5 (diff)
downloadbuildstream-21050433863a5f470718bd5dbb54a0476e229b30.tar.gz
tests/format/options.py: Added tests for invalid variable names in options
Diffstat (limited to 'tests/format')
-rw-r--r--tests/format/options.py11
-rw-r--r--tests/format/options/invalid-variable-name-plus/element.bst2
-rw-r--r--tests/format/options/invalid-variable-name-plus/project.conf8
-rw-r--r--tests/format/options/invalid-variable-name-spaces/element.bst2
-rw-r--r--tests/format/options/invalid-variable-name-spaces/project.conf8
5 files changed, 31 insertions, 0 deletions
diff --git a/tests/format/options.py b/tests/format/options.py
index b537fdfbf..2076106cb 100644
--- a/tests/format/options.py
+++ b/tests/format/options.py
@@ -25,6 +25,17 @@ def test_invalid_option_name(cli, datafiles, project_dir):
@pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.parametrize("project_dir", [
+ ('invalid-variable-name-spaces'),
+ ('invalid-variable-name-plus'),
+])
+def test_invalid_variable_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-variable-name-plus/element.bst b/tests/format/options/invalid-variable-name-plus/element.bst
new file mode 100644
index 000000000..e006c8a96
--- /dev/null
+++ b/tests/format/options/invalid-variable-name-plus/element.bst
@@ -0,0 +1,2 @@
+kind: autotools
+
diff --git a/tests/format/options/invalid-variable-name-plus/project.conf b/tests/format/options/invalid-variable-name-plus/project.conf
new file mode 100644
index 000000000..5652bb8b3
--- /dev/null
+++ b/tests/format/options/invalid-variable-name-plus/project.conf
@@ -0,0 +1,8 @@
+name: test
+
+options:
+ pony:
+ type: bool
+ description: Whether a pony
+ default: False
+ variable: pony+
diff --git a/tests/format/options/invalid-variable-name-spaces/element.bst b/tests/format/options/invalid-variable-name-spaces/element.bst
new file mode 100644
index 000000000..e006c8a96
--- /dev/null
+++ b/tests/format/options/invalid-variable-name-spaces/element.bst
@@ -0,0 +1,2 @@
+kind: autotools
+
diff --git a/tests/format/options/invalid-variable-name-spaces/project.conf b/tests/format/options/invalid-variable-name-spaces/project.conf
new file mode 100644
index 000000000..5115115bf
--- /dev/null
+++ b/tests/format/options/invalid-variable-name-spaces/project.conf
@@ -0,0 +1,8 @@
+name: test
+
+options:
+ pony:
+ type: bool
+ description: Whether a pony
+ default: False
+ variable: the variable