Skip to content

Example Test Suite: command containing '#' is not workingΒ #6621

Closed

Description

@vaslabs

Reproduction steps

  1. Add a command containing '#' , even with single quotes. For example in the android java test (1-hello-world)
/** Usage
> ./mill show app.it -e class 'com.helloworld.logictest.SampleLogicInstrumentedTest#testTextSize'
..."status": "Success"...
*/

Also tried: double quotes, escaping (\#)

  1. Running the example:
./mill example.androidlib.java[1-hello-world]

Results in

8965] /home/vnicolaou/mill/out/example/androidlib/java/1-hello-world/testForked.dest/sandbox/run-1> ./mill  --ticker false shutdown
8965] 
8965] X mill.testkit.UtestExampleTestSuite.exampleTest 42224ms 
8965]   utest.AssertionError: evalResult.exitCode == 0
8965]   evalResult: EvalResult = EvalResult(
8965]     command = ArraySeq(
8965]       "bash",
8965]       "-c",
8965]       "./mill  --ticker false show app.it -e class 'com.helloworld.logictest.SampleLogicInstrumentedTest"
8965]     ),
8965]     exitCode = 2,
8965]     outErr = """bash: -c: line 1: unexpected EOF while looking for matching `''
8965]   """
8965]   )

Found as part of #6543

Activity

  1. vaslabs commented on Jan 19, 2026

    @vaslabs
    ContributorAuthor

    Probably matches this before#after in ExampleTester

    val (commandHead, comment) = commandBlockLines.head match {
          case s"$before#$after" => (before.trim, Some(after.trim))
          case string => (string, None)
        }
  2. vaslabs commented on Jan 19, 2026

    @vaslabs
    ContributorAuthor

    maybe we do it with a space? it's not a standard as far as I can tell/find, but

    Image
  3. vaslabs commented on Jan 19, 2026

    @vaslabs
    ContributorAuthor

    changing to case s"$before #$after" => (before.trim, Some(after.trim)) gives a somewhat easy way to workaround this, otherwise I can implement some escaping + single quotes, though it's gonna get complex

  4. vaslabs commented on Jan 19, 2026

    @vaslabs
    ContributorAuthor
  5. vaslabs commented on Jan 19, 2026

    @vaslabs
    ContributorAuthor

    looks ok with the space (but my branch is based on this branch so I can do it after that one is merged)

  6. lefou commented on Jan 19, 2026

    @lefou
    Member

    I think the example test suite tries to mimic a regular shell and # is the typical comment symbol in shells, so keeping the # is IMHO the most intuitive thing. We either want to enforce a leading space before the # or implement some masking via \#. We should also look how shells like bash or zsh handle it, which is probably a full parsing routine supporting quoting and any kind of nested masking. We have that at hand (via fastparse) but it's probably overkill.

  7. vaslabs commented on Jan 19, 2026

    @vaslabs
    ContributorAuthor

    I think the example test suite tries to mimic a regular shell and # is the typical comment symbol in shells, so keeping the # is IMHO the most intuitive thing. We either want to enforce a leading space before the # or implement some masking via \#. We should also look how shells like bash or zsh handle it, which is probably a full parsing routine supporting quoting and any kind of nested masking. We have that at hand (via fastparse) but it's probably overkill.

    it it's good enough for you the space seems to not be breaking anything we have in the example tests so far. At least on my local, my bash seems to interpret the '#' as a string continuation (without a space)

  8. lefou commented on Jan 19, 2026

    @lefou
    Member

    Let's add the space before # requirement to make it a comment, as you suggested.

  9. vaslabs commented on Feb 15, 2026

    @vaslabs
    ContributorAuthor

    @souvlakias a quick one for tomorrow + to add the #method test , my branch here is out of sync so can create a fresh one

    https://github.com/vaslabs-ltd/mill/tree/test-hash-example-tester

  10. added this to the 1.1.3 milestone on Feb 16, 2026
  11. added a commit that references this issue on Feb 16, 2026
    a3fba10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions