Fork of daniellemaywood.uk/gleam — Wasm codegen work
803 B
66 lines
1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: 2023 The Gleam contributors
3
4use crate::assert_erl;
5
6#[test]
7fn panic_as() {
8 assert_erl!(
9 r#"
10pub fn main() {
11 panic as "wibble"
12}
13"#
14 );
15}
16
17#[test]
18fn plain() {
19 assert_erl!(
20 r#"
21pub fn main() {
22 panic
23}
24"#
25 );
26}
27
28#[test]
29fn panic_as_function() {
30 assert_erl!(
31 r#"
32pub fn retstring() {
33 "wibble"
34}
35pub fn main() {
36 panic as { retstring() <> "wobble" }
37}
38"#
39 );
40}
41
42// https://github.com/gleam-lang/gleam/issues/2176
43#[test]
44fn piped() {
45 assert_erl!(
46 r#"
47pub fn main() {
48 "lets"
49 |> panic
50}
51 "#
52 );
53}
54
55#[test]
56fn piped_chain() {
57 assert_erl!(
58 r#"
59 pub fn main() {
60 "lets"
61 |> panic as "pipe"
62 |> panic as "other panic"
63 }
64 "#
65 );
66}