tobogganSe connecter

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.

36 lignes · 845 octetsBrut · Historique
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
9import std/result
10
11@test
12fn 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
20fn qualified :: -> Int
21//~^ ERROR E0126 `qualified` is not a test but uses `std/list`
22{
23 list.length [1, 2]
24}
25
26fn by_name :: -> Int
27//~^ ERROR E0126 `by_name` is not a test but uses `std/option`
28{
29 unwrap_or None 1
30}
31
32fn twice :: -> Int
33//~^ ERROR E0126 `twice` is not a test but uses `std/list`
34{
35 list.length [1] + list.length [2]
36}