Add gen test for multiple ability bounds

This commit is contained in:
Ayaz Hafiz 2022-10-12 16:35:01 -05:00
parent 3bd10698cf
commit 152400dea3
No known key found for this signature in database
GPG Key ID: 0E2A37416A25EF58

View File

@ -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() {