alpha
Login
or
Join now
nandi.uk
/
gleam
Star
2
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Fork of daniellemaywood.uk/gleam — Wasm codegen work
Star
2
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
Add JavaScript codegen snapshot test
author
Justin Lubin
committer
Louis Pilfold
date
5 months ago
(Feb 25, 2026, 5:15 PM UTC)
commit
1fc83881
1fc838817c79a9bca83e842b023075e56ab1812b
parent
93167fc8
93167fc898161d0e816d3a63d1ff7bfc96282fba
+50
2 changed files
Expand all
Collapse all
Unified
Split
compiler-core
src
javascript
tests
case.rs
snapshots
gleam_core__javascript__tests__case__directly_matching_case_subject.snap
+21
compiler-core/src/javascript/tests/case.rs
View file
Reviewed
···
922
922
}"#
923
923
)
924
924
}
925
925
+
926
926
+
#[test]
927
927
+
fn directly_matching_case_subject() {
928
928
+
assert_js!(
929
929
+
r#"
930
930
+
pub fn go() {
931
931
+
let x = "ABC"
932
932
+
case True {
933
933
+
True -> {
934
934
+
let x = 79
935
935
+
0
936
936
+
}
937
937
+
False -> {
938
938
+
let x = True
939
939
+
0
940
940
+
}
941
941
+
}
942
942
+
x
943
943
+
}"#
944
944
+
)
945
945
+
}
+29
compiler-core/src/javascript/tests/snapshots/gleam_core__javascript__tests__case__directly_matching_case_subject.snap
View file
Reviewed
···
1
1
+
---
2
2
+
source: compiler-core/src/javascript/tests/case.rs
3
3
+
expression: "\npub fn go() {\n let x = \"ABC\"\n case True {\n True -> {\n let x = 79\n 0\n }\n False -> {\n let x = True\n 0\n }\n }\n x\n}"
4
4
+
---
5
5
+
----- SOURCE CODE
6
6
+
7
7
+
pub fn go() {
8
8
+
let x = "ABC"
9
9
+
case True {
10
10
+
True -> {
11
11
+
let x = 79
12
12
+
0
13
13
+
}
14
14
+
False -> {
15
15
+
let x = True
16
16
+
0
17
17
+
}
18
18
+
}
19
19
+
x
20
20
+
}
21
21
+
22
22
+
----- COMPILED JAVASCRIPT
23
23
+
export function go() {
24
24
+
let x = "ABC";
25
25
+
let $ = true;
26
26
+
let x$1 = 79;
27
27
+
0
28
28
+
return x;
29
29
+
}