Sign inSign up

techio/sbt-runner

By techio

Updated over 9 years ago

Image
0

406

techio/sbt-runner repository overview

sbt-runner

This is a Scala 2.12 runner that fetches dependencies using sbt, and executes tests using sbt as well.

How to Use

In order to use this runner for your project, edit the codingame.yml file and add the following lines to your project:

    runner: techio/sbt-runner:1.0.1

Example

We're using the following project:

.
├── build.sbt
├── codingame.yml
└── src
    ├── main
    │   └── scala
    │       └── example
    │           └── Hello.scala
    └── test
        └── scala
            └── example
                └── HelloSpec.scala

In this example, the user is asked to write a hello world (in Hello.scala):

package example

object Hello extends Greeting with App {
  println(greeting)
}

trait Greeting {
  lazy val greeting: String = "hello"
}

In order to test the answer, the following unit test is created (in HelloSpec.scala):

package example

import org.scalatest._

class HelloSpec extends FlatSpec with Matchers {
  "The Hello object" should "say hello" in {
    Hello.greeting shouldEqual "hello"
  }
}

The sbt build configuration is:

organization := "com.example"
version := "0.1.0-SNAPSHOT"
name := "Hello world"
scalaVersion := "2.11.8"

libraryDependencies += "org.scalatest" %% "scalatest" % "3.0.0"

In the markdown file, the unit test can be called using:

@[Hello world!]({"stubs":["src/main/scala/example/Hello.scala"], "command":"example.HelloSpec"})

Tag summary

Content type

Image

Digest

Size

365 MB

Last updated

over 9 years ago

docker pull techio/sbt-runner