1use crate::{assert_js, assert_ts_def};
2
3#[test]
4fn without_message() {
5 assert_js!(
6 r#"
7pub fn go() {
8 todo
9}
10"#,
11 );
12}
13
14#[test]
15fn without_message_typescript() {
16 assert_ts_def!(
17 r#"
18pub fn go() {
19 todo
20}
21"#,
22 );
23}
24
25#[test]
26fn with_message() {
27 assert_js!(
28 r#"
29pub fn go() {
30 todo as "I should do this"
31}
32"#,
33 );
34}
35
36#[test]
37fn with_message_expr() {
38 assert_js!(
39 r#"
40pub fn go() {
41 let x = "I should " <> "do this"
42 todo as x
43}
44"#,
45 );
46}
47
48// https://github.com/gleam-lang/gleam/issues/1238
49#[test]
50fn as_expression() {
51 assert_js!(
52 r#"
53pub fn go(f) {
54 let boop = todo as "I should do this"
55 f(todo as "Boom")
56}
57"#,
58 );
59}
60
61// https://github.com/gleam-lang/gleam/issues/4471
62#[test]
63fn case_message() {
64 assert_js!(
65 r#"
66pub fn unimplemented(message) {
67 panic as case message {
68 Ok(message) -> message
69 Error(_) -> "No message provided"
70 }
71}
72"#
73 );
74}
75
76#[test]
77fn inside_fn() {
78 assert_js!(
79 r#"
80pub fn main() {
81 fn() { todo }
82}
83"#
84 );
85}