Skip to content

Standardize on //> using in tests. #18149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
odersky opened this issue Jul 5, 2023 · 6 comments
Open

Standardize on //> using in tests. #18149

odersky opened this issue Jul 5, 2023 · 6 comments

Comments

@odersky
Copy link
Contributor

odersky commented Jul 5, 2023

Tests currently use the // scala: ... syntax to add an option to the compilation. Example:

// scalac: -Wunused:privates

They should be using //> using instead. We should reinforce conventions rather than creating alternative ones.

I think this would be a good issue for the spree.

@odersky odersky added stat:needs triage Every issue needs to have an "area" and "itype" label area:infrastructure Spree Suitable for a future Spree and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Jul 5, 2023
@odersky odersky changed the title // scalac: -Wunused:privates Standardize on //> using in tests. Jul 5, 2023
@dwijnand
Copy link
Member

dwijnand commented Jul 5, 2023

To be fair, // scalac predates the using one...

But, pedantics aside, I'm strongly in favour!

@odersky
Copy link
Contributor Author

odersky commented Jul 5, 2023

Ah yes, I mis-spoke. It's just that I came across // scalac: only today.

@lrytz
Copy link
Member

lrytz commented Jul 5, 2023

(Scala 2: scala/scala#10405)

@som-snytt
Copy link
Contributor

There are test-only pragmas that it would be nice to adopt or make standard, such as to express "this test should be run only under certain JVM versions" (as opposed to requesting a specific JVM version).

Maybe just a tweak such as

//> using jvm 17+

or maybe support for test tags or groups. I haven't used scala-cli test command yet, but presumably any test should be runnable that way.

The colon syntax in dotty supports:

/** Famous tool names in the ecosystem. Used for tool args in test files. */
enum ToolName:
  case Scala, Scalac, Java, Javac, ScalaJS, Test

bishabosha added a commit that referenced this issue Sep 28, 2023
- update remaining `// scalac:` to `//> using options` in tests
- throw error when using old syntax in tests

fixes `scalac:` portion of #18149
still to do:
- rewrite `// test: -jvm 15+` to use a directive
- support `// scalajs: --skip` with a directive or similar

once this is done, we can remove the `toolArg` regex
@mbovel
Copy link
Member

mbovel commented Jan 14, 2024

Is this issue solved by #18413?

@mbovel mbovel removed the Spree Suitable for a future Spree label Jan 14, 2024
@som-snytt
Copy link
Contributor

I intended to follow up about the other use cases for jvm version and sjs skipping. I'll look later today, for some reason I recently had the browser tab open.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants