Skip to content
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

Support test-in-src #2832

Closed
antholeole opened this issue Apr 1, 2024 · 2 comments
Closed

Support test-in-src #2832

antholeole opened this issue Apr 1, 2024 · 2 comments
Labels
duplicate This issue or pull request already exists enhancement New feature or request

Comments

@antholeole
Copy link

Hello! One feature that i'd like to have is to be able to write the source and the test in the same file - that way I can just write one off scripts without having to worry about keeping the test file next to the implementation file.

Something like the following:

//> using test.dep org.scalameta::munit::0.7.29

object Hello {
  def main(args: Array[String]): Unit = {
    println(addOne(3))
  }

  def addOne(x: Integer) = x + 1
}

  class HelloTest extends munit.FunSuite {
    test("foo") {
      assert(Hello.addOne(3) == 4)
    }
  }

and then scala-cli Hello.scala would run Hello.main, while scala-cli test Hello.scala would run the test suite defined in HelloTest. Is this feasible or something that we want? I would be open to writing this feature if it's something that would be accepted. If so, I can write up a RFC-like to get some opinions on the design. Thanks!

@antholeole antholeole added the enhancement New feature or request label Apr 1, 2024
@Gedochao
Copy link
Contributor

Gedochao commented Apr 2, 2024

Duplicate of #1093, should be tracked there.
Closing this.

@Gedochao Gedochao closed this as not planned Won't fix, can't repro, duplicate, stale Apr 2, 2024
@Gedochao Gedochao added the duplicate This issue or pull request already exists label Apr 2, 2024
@Gedochao
Copy link
Contributor

Gedochao commented Apr 2, 2024

@antholeole If you are indeed interested in implementing this, let's track it in #1093.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants