Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/basilisp/test.lpy
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line made the assumption that (first expr) is always a symbol, which seemed dangerous to me. While investigating, I ended up fixing it and incorporating the fix into #831 (which also includes thrown-with-msg? assertion).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for looking into it in detail!

:else :default)))

(defmethod gen-assert '=
Expand Down
19 changes: 18 additions & 1 deletion tests/basilisp/testrunner_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,20 @@ 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()
yield pytester.runpytest()
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(
Expand Down Expand Up @@ -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=(
Expand Down