louise
The Louise language: compiler, runtime, std, tooling
Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.
Dernier runRéussi#125 · main · 16 min 13 s
0Étoiles
0Forks
40Issues
| 1 | // `@test import` brings a module in for tests only (ADR 0064): a `@test` |
| 2 | // function may use it, any other item is E0126, and a program build drops |
| 3 | // it with the tests. No other attribute applies to an import (E0114). |
| 4 | |
| 5 | @test import std/list |
| 6 | @test import std/option.{unwrap_or} |
| 7 | |
| 8 | @should_panic "no" //~ ERROR E0114 `@should_panic` does not apply to an import |
| 9 | import std/result |
| 10 | |
| 11 | @test |
| 12 | fn a_test_may_use_both :: |
| 13 | { |
| 14 | let _ = list.length [1, 2] |
| 15 | let _ = unwrap_or None 1 |
| 16 | let _ = result.is_ok (Ok(1)) |
| 17 | () |
| 18 | } |
| 19 | |
| 20 | fn qualified :: -> Int |
| 21 | //~^ ERROR E0126 `qualified` is not a test but uses `std/list` |
| 22 | { |
| 23 | list.length [1, 2] |
| 24 | } |
| 25 | |
| 26 | fn by_name :: -> Int |
| 27 | //~^ ERROR E0126 `by_name` is not a test but uses `std/option` |
| 28 | { |
| 29 | unwrap_or None 1 |
| 30 | } |
| 31 | |
| 32 | fn twice :: -> Int |
| 33 | //~^ ERROR E0126 `twice` is not a test but uses `std/list` |
| 34 | { |
| 35 | list.length [1] + list.length [2] |
| 36 | } |