The students_code.scala contained a single object where the code is added by the students. Testing_code.scala then contains a number of asserts, which bomb if something does not work.
Is there anything equivalent for Scala 3? It seems the commandline options -i and -e are dispensed of in Scala 3.
I tested it with the following setup. In the same directory I have two files:
This is file studentCode.scala
package code
object StudentCode:
// say this is supposed to check if n is even
def studentFunction(n: Int): Boolean =
??? // students would write code here
This is file studentCode.test.scala
//> using test.dep org.scalameta::munit::0.7.29
package code
class MyTests extends munit.FunSuite:
import StudentCode.*
test("studentFun") {
assert(studentFunction(2))
assert(!studentFunction(3))
}
Then I ran in the same directory:
scala-cli test .
and it gives (with the correct code in studentFunction):