practicalli / practicalli/clojure

test runners ignoring reader comment macro

Open
#53 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

clojure cli testing
Dominant language
Makefile
Stars
117
Forks
36
PR merge metrics
No merged PRs in 30d

Description

This is a bug in my understanding of the Clojure comment reader macro. Anything commented out with #_ still needs to be a valid form, otherwise how does the Clojure reader know where the comment ends :)

The CIDER test runner lets you get away with dodgy code in your source file, as it doesnt parse the source code file and just uses the expressions defined in the REPL already.

When running cognitect test runner

clojure -A:test:runner

An expression commented out with the #_ reader macro generated an error as the expression had a a missing value in a hashmap {()}

Terminal output

clojure -A:test:runner
Cloning: https://github.com/cognitect-labs/test-runner
Checking out: https://github.com/cognitect-labs/test-runner at 76568540e7f40268ad2b646110f237a60295fa3c
Downloading: org/clojure/tools.cli/0.3.5/tools.cli-0.3.5.jar from https://repo1.maven.org/maven2/

Running tests in #{"test"}
Syntax error reading source at (cervest/web_crawler.clj:93:10).
Map literal must contain an even number of forms

Full report at:
/tmp/clojure-67461614151858564.edn

The same thing happens with eftest :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the report with clojure -A:test:runner and eftest, then inspect cervest/web_crawler.clj around line 93 and the test-runner entry points. Compare how the runners read source versus existing REPL expressions; completion requires an agreed expected behavior and a regression test for the #_ case.

Written by the indexing model from the issue text.

Assessment

Tech stack
clojure
Domain
cli, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.