Fork of daniellemaywood.uk/gleam — Wasm codegen work
Something went wrong. Try again.
1.9 kB · 150 lines
Rust
at wasm
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: 2021 The Gleam contributors
use crate::{assert_js, assert_ts_def};
#[test]fn tuple() { assert_js!( r#"pub fn go() { #("1", "2", "3")}"#, );}
#[test]fn tuple1() { assert_js!( r#"pub fn go() { #( "1111111111111111111111111111111", #("1111111111111111111111111111111", "2", "3"), "3", )}"#, );}
#[test]fn tuple_typescript() { assert_ts_def!( r#"pub fn go() { #("1", "2", "3")}"#, );}
#[test]fn tuple_access() { assert_js!( r#"pub fn go() { #(1, 2).0}"#, )}
#[test]fn tuple_with_block_element() { assert_js!( r#"pub fn go() { #( "1", { "2" "3" }, )}"#, );}
#[test]fn tuple_with_block_element1() { assert_js!( r#"pub fn go() { #( "1111111111111111111111111111111", #("1111111111111111111111111111111", "2", "3"), "3", )}"#, );}
#[test]fn constant_tuples() { assert_js!( r#"pub const a = "Hello"pub const b = 1pub const c = 2.0pub const e = #("bob", "dug") "#, );}
#[test]fn constant_tuples1() { assert_js!( r#"pub const e = #( "loooooooooooooong", "loooooooooooong", "loooooooooooooong", "loooooooooooooong", "loooooooooooong", "loooooooooooooong",)"# );}
#[test]fn tuple_formatting_typescript() { assert_ts_def!( r#"pub const e = #( "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a", "a",)"# );}
#[test]fn case() { assert_js!( r#"pub fn go(a) { case a { #(2, a) -> a #(1, 1) -> 1 #(a, b) -> a + b }}"# );}
#[test]fn nested_pattern() { assert_js!( r#"pub fn go(x) { case x { #(2, #(a, b)) -> a + b _ -> 1 }}"# );}