Last active
February 3, 2026 20:22
-
-
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/e560403b0fd508ea9b1826d4c2b51ff32c12953c
This file contains hidden or 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 License Version 2.0 (https://www.apache.org/licenses/LICENSE-2.0.txt) | |
| // 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