Fork of daniellemaywood.uk/gleam — Wasm codegen work
Something went wrong. Try again.
874 B · 64 lines
Rust
at wasm
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465// SPDX-License-Identifier: Apache-2.0// SPDX-FileCopyrightText: 2022 The Gleam contributors
use crate::assert_js;
#[test]fn tco() { assert_js!( r#"pub fn main(x) { case x { 0 -> Nil _ -> main(x - 1) }}"# );}
#[test]fn tco_case_block() { assert_js!( r#"pub fn main(x) { case x { 0 -> Nil _ -> { let y = x main(y - 1) } }}"# );}
// https://github.com/gleam-lang/gleam/issues/1779#[test]fn not_tco_due_to_assignment() { assert_js!( r#"pub fn main(x) { let z = { let y = x main(y - 1) } z}"# );}
// https://github.com/gleam-lang/gleam/issues/2400#[test]fn shadowing_so_not_recursive() { // This funtion is calling an argument with the same name as itself, so it is not recursive assert_js!( r#"pub fn map(map) { map()}"# );}