mirror of
https://github.com/Paillat-dev/hello-world-scala.git
synced 2026-01-02 09:16:21 +00:00
First commit
This commit is contained in:
6
src/main/resources/hello.txt
Normal file
6
src/main/resources/hello.txt
Normal file
@@ -0,0 +1,6 @@
|
||||
██╗ ██╗███████╗██╗ ██╗ ██████╗ ██╗ ██╗ ██████╗ ██████╗ ██╗ ██████╗
|
||||
██║ ██║██╔════╝██║ ██║ ██╔═══██╗ ██║ ██║██╔═══██╗██╔══██╗██║ ██╔══██╗
|
||||
███████║█████╗ ██║ ██║ ██║ ██║ ██║ █╗ ██║██║ ██║██████╔╝██║ ██║ ██║
|
||||
██╔══██║██╔══╝ ██║ ██║ ██║ ██║ ██║███╗██║██║ ██║██╔══██╗██║ ██║ ██║
|
||||
██║ ██║███████╗███████╗███████╗╚██████╔╝ ╚███╔███╔╝╚██████╔╝██║ ██║███████╗██████╔╝
|
||||
╚═╝ ╚═╝╚══════╝╚══════╝╚══════╝ ╚═════╝ ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚══════╝╚═════╝
|
||||
23
src/main/scala/Main.scala
Normal file
23
src/main/scala/Main.scala
Normal file
@@ -0,0 +1,23 @@
|
||||
import fansi.Attr
|
||||
import fansi.Color
|
||||
import scala.io.Source
|
||||
|
||||
def colors: List[Attr] = List(
|
||||
Color.Red,
|
||||
Color.LightRed,
|
||||
Color.Yellow,
|
||||
Color.Green,
|
||||
Color.Blue,
|
||||
Color.Magenta
|
||||
)
|
||||
|
||||
val message: String = Source.fromResource("hello.txt").mkString
|
||||
|
||||
@main def hello(): Unit = {
|
||||
val splitMessage: Array[String] = message.split("\n")
|
||||
for (i <- splitMessage.indices) {
|
||||
val colorIndex = i % colors.length
|
||||
val coloredLine = colors(colorIndex)(splitMessage(i))
|
||||
println(coloredLine)
|
||||
}
|
||||
}
|
||||
9
src/test/scala/MySuite.scala
Normal file
9
src/test/scala/MySuite.scala
Normal file
@@ -0,0 +1,9 @@
|
||||
// For more information on writing tests, see
|
||||
// https://scalameta.org/munit/docs/getting-started.html
|
||||
class MySuite extends munit.FunSuite {
|
||||
test("example test that succeeds") {
|
||||
val obtained = 42
|
||||
val expected = 42
|
||||
assertEquals(obtained, expected)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user