mirror of
https://github.com/roc-lang/roc.git
synced 2024-09-22 08:17:40 +03:00
Add gen test for multiple ability bounds
This commit is contained in:
parent
3bd10698cf
commit
152400dea3
@ -219,6 +219,33 @@ fn ability_used_as_type_still_compiles() {
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn bounds_to_multiple_abilities() {
|
||||
assert_evals_to!(
|
||||
indoc!(
|
||||
r#"
|
||||
app "test" provides [main] to "./platform"
|
||||
|
||||
Idempot has idempot : a -> a | a has Idempot
|
||||
Consume has consume : a -> Str | a has Consume
|
||||
|
||||
Hello := Str has [Idempot { idempot: idempotHello }, Consume { consume: consumeHello }]
|
||||
|
||||
idempotHello = \@Hello msg -> @Hello msg
|
||||
consumeHello = \@Hello msg -> msg
|
||||
|
||||
lifecycle : a -> Str | a has Idempot & Consume
|
||||
lifecycle = \x -> idempot x |> consume
|
||||
|
||||
main = lifecycle (@Hello "hello world")
|
||||
"#
|
||||
),
|
||||
RocStr::from("hello world"),
|
||||
RocStr
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(any(feature = "gen-llvm", feature = "gen-wasm"))]
|
||||
fn encode() {
|
||||
|
Loading…
Reference in New Issue
Block a user