diff --git a/CHANGELOG.md b/CHANGELOG.md index ab2afa35f..5fe80467b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 * Fix issue with the variadic ampersand operator treated as a binding in macros (#772) * Fix a bug the variadic arg symbol was not correctly bound to `nil` when no variadic arguments were provided (#801) * Fix a bug where the quotient of very large numbers was incorrect (#822) + * Fix a bug where `basilisp.test/is` may fail to generate expected/actual info on failures when declared inside a macro (#829) ### Removed * Removed support for PyPy 3.8 (#785) diff --git a/src/basilisp/test.lpy b/src/basilisp/test.lpy index 13ff13963..2ef20ca85 100644 --- a/src/basilisp/test.lpy +++ b/src/basilisp/test.lpy @@ -73,7 +73,7 @@ "Implementation detail of :lpy:fn:`is` for generating macros." (fn [expr _ _] (cond - (list? expr) (first expr) + (and (sequential? expr) (not (vector? expr))) (symbol (name (first expr))) :else :default))) (defmethod gen-assert '= diff --git a/tests/basilisp/testrunner_test.py b/tests/basilisp/testrunner_test.py index f176f8d3d..2ed7b0751 100644 --- a/tests/basilisp/testrunner_test.py +++ b/tests/basilisp/testrunner_test.py @@ -37,6 +37,12 @@ def run_result(self, pytester: pytest.Pytester) -> pytest.RunResult: (deftest error-test (throw (ex-info "This test will count as an error." {}))) + + ;; syntax quote expands lists to seqs. + (defmacro syntax-quote-test-make [] + `(deftest syntax-quote-seq-test + (is (= 5 4)))) + (syntax-quote-test-make) """ pytester.makefile(".lpy", test_testrunner=code) pytester.syspathinsert() @@ -44,7 +50,7 @@ def run_result(self, pytester: pytest.Pytester) -> pytest.RunResult: runtime.Namespace.remove(sym.symbol("test-testrunner")) def test_outcomes(self, run_result: pytest.RunResult): - run_result.assert_outcomes(passed=1, failed=2) + run_result.assert_outcomes(passed=1, failed=3) def test_failure_repr(self, run_result: pytest.RunResult): run_result.stdout.fnmatch_lines( @@ -81,6 +87,17 @@ def test_failure_repr(self, run_result: pytest.RunResult): consecutive=True, ) + run_result.stdout.fnmatch_lines( + [ + "FAIL in (syntax-quote-seq-test) (test_testrunner.lpy)", + " Test failure: (basilisp.core/= 5 4)", + "", + " expected: 5", + " actual: 4", + ], + consecutive=True, + ) + @pytest.mark.xfail( platform.python_implementation() == "PyPy" and sys.version_info < (3, 9), reason=(