Last active
May 25, 2024 10:19
-
-
Save dacr/39b0633346746dcbed4a8b7813f9b9bc to your computer and use it in GitHub Desktop.
com-lihaoyi utest basic usage examples / published by https://github.com/dacr/code-examples-manager #b49ceaa6-9a2a-4d83-9b5d-9e563a576fc4/b43b602c5508c24441dac20cb4f44e5e1fe2186f
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// summary : com-lihaoyi utest basic usage examples | |
// keywords : scala, lihaoyi, utest, @testable | |
// publish : gist | |
// authors : David Crosson | |
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// id : b49ceaa6-9a2a-4d83-9b5d-9e563a576fc4 | |
// created-on : 2024-01-06T16:54:05+01:00 | |
// managed-by : https://github.com/dacr/code-examples-manager | |
// run-with : scala-cli $file | |
// --------------------- | |
//> using scala "3.4.2" | |
//> using test.dep "com.lihaoyi::utest:0.8.2" | |
//> using target.scope test | |
// --------------------- | |
import utest.* | |
object NestedTests extends TestSuite { | |
val tests = Tests { | |
val x = 1 | |
test("outer1") { | |
val y = x + 1 | |
test("inner1") { | |
assert(x == 1, y == 2) | |
(x, y) | |
} | |
test("inner2") { | |
val z = y + 1 | |
assert(z == 4) | |
} | |
} | |
test("outer2") { | |
test("inner3") { | |
assert(x > 1) | |
} | |
} | |
} | |
} | |
// TODO didn't yet run as a script :( |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment