diff options
Diffstat (limited to 'tests/format')
-rw-r--r-- | tests/format/junctions.py | 27 | ||||
-rw-r--r-- | tests/format/junctions/invalid/junctiondep-not-a-junction.bst | 4 |
2 files changed, 31 insertions, 0 deletions
diff --git a/tests/format/junctions.py b/tests/format/junctions.py index 210455cb4..3a215761a 100644 --- a/tests/format/junctions.py +++ b/tests/format/junctions.py @@ -81,6 +81,9 @@ def test_junction_missing_project_conf(cli, datafiles): result = cli.run(project=project, args=['build', 'app.bst']) result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_JUNCTION) + # Assert that we have the expected provenance encoded into the error + assert "app.bst [line 6 column 2]" in result.stderr + @pytest.mark.datafiles(DATA_DIR) def test_workspaced_junction_missing_project_conf(cli, datafiles): @@ -102,6 +105,9 @@ def test_workspaced_junction_missing_project_conf(cli, datafiles): result = cli.run(project=project, args=['build', 'app.bst']) result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_JUNCTION) + # Assert that we have the expected provenance encoded into the error + assert "app.bst [line 6 column 2]" in result.stderr + @pytest.mark.datafiles(DATA_DIR) def test_build_of_same_junction_used_twice(cli, datafiles): @@ -203,6 +209,8 @@ def test_nested_conflict(cli, datafiles): result = cli.run(project=project, args=['build', 'target.bst']) result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.CONFLICTING_JUNCTION) + assert "bar.bst:target.bst [line 3 column 2]" in result.stderr + # Test that we error correctly when the junction element itself is missing @pytest.mark.datafiles(DATA_DIR) @@ -243,6 +251,19 @@ def test_invalid_junction_dep(cli, datafiles): result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA) +# Test that we error correctly when we junction-depend on a non-junction +@pytest.mark.datafiles(DATA_DIR) +def test_invalid_junctiondep_not_a_junction(cli, datafiles): + project = os.path.join(str(datafiles), 'invalid') + copy_subprojects(project, datafiles, ['base']) + + result = cli.run(project=project, args=['build', 'junctiondep-not-a-junction.bst']) + result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_DATA) + + # Assert that we have the expected provenance encoded into the error + assert "junctiondep-not-a-junction.bst [line 3 column 2]" in result.stderr + + @pytest.mark.datafiles(DATA_DIR) def test_options_default(cli, tmpdir, datafiles): project = os.path.join(str(datafiles), 'options-default') @@ -316,6 +337,9 @@ def test_git_show(cli, tmpdir, datafiles): result = cli.run(project=project, args=['show', 'target.bst']) result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.SUBPROJECT_FETCH_NEEDED) + # Assert that we have the expected provenance encoded into the error + assert "target.bst [line 3 column 2]" in result.stderr + # Explicitly fetch subproject result = cli.run(project=project, args=['source', 'fetch', 'base.bst']) result.assert_success() @@ -380,6 +404,9 @@ def test_git_missing_project_conf(cli, tmpdir, datafiles): result = cli.run(project=project, args=['build', 'app.bst']) result.assert_main_error(ErrorDomain.LOAD, LoadErrorReason.INVALID_JUNCTION) + # Assert that we have the expected provenance encoded into the error + assert "app.bst [line 6 column 2]" in result.stderr + @pytest.mark.datafiles(DATA_DIR) def test_cross_junction_names(cli, datafiles): diff --git a/tests/format/junctions/invalid/junctiondep-not-a-junction.bst b/tests/format/junctions/invalid/junctiondep-not-a-junction.bst new file mode 100644 index 000000000..c59f1be25 --- /dev/null +++ b/tests/format/junctions/invalid/junctiondep-not-a-junction.bst @@ -0,0 +1,4 @@ +kind: stack +depends: +- junction: app.bst + filename: target.bst |