tangled
alpha
login
or
join now
daniellemaywood.uk
/
gleam
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
Empty tests
Louis Pilfold
3 years ago
a29bb467
f226fd82
+49
-5
11 changed files
expand all
collapse all
unified
split
.gitignore
Makefile
compiler-core
src
build
package_compilation_tests.rs
test-package-compiler
build.rs
cases
erlang_empty
gleam.toml
src
empty.gleam
javascript_empty
gleam.toml
src
empty.gleam
src
lib.rs
snapshots
test_package_compiler__generated_tests__erlang_empty.snap
test_package_compiler__generated_tests__javascript_empty.snap
+1
-1
.gitignore
···
7
7
erl_crash.dump
8
8
*.lock
9
9
node_modules/
10
10
-
**/src/generated_tests.rs
10
10
+
test-package-compiler/src/generated_tests.rs
+1
-1
Makefile
···
41
41
42
42
.PHONY: test-watch
43
43
test-watch: ## Run compiler tests when files change
44
44
-
watchexec -e rs,html,capnp "cargo test --quiet"
44
44
+
watchexec --changes-only -e rs,gleam,html,capnp "cargo test --quiet"
45
45
46
46
# Debug print vars with `make print-VAR_NAME`
47
47
print-%: ; @echo $*=$($*)
-2
compiler-core/src/build/package_compilation_tests.rs
···
159
159
160
160
#[test]
161
161
fn package_compiler_test() {
162
162
-
assert_erlang_compile!(vec![], Ok(vec![]));
163
163
-
164
162
assert_erlang_compile!(
165
163
vec![Source {
166
164
path: PathBuf::from("src/one.gleam"),
+2
test-package-compiler/build.rs
···
1
1
use std::path::PathBuf;
2
2
3
3
pub fn main() {
4
4
+
println!("cargo:rerun-if-changed=cases");
5
5
+
4
6
let mut module = "/// This file is generated by build.rs
5
7
/// Do not edit it directly, instead add new test cases to ./cases
6
8
+3
test-package-compiler/cases/erlang_empty/gleam.toml
···
1
1
+
name = "hello_joe"
2
2
+
version = "0.1.0"
3
3
+
target = "erlang"
+1
test-package-compiler/cases/erlang_empty/src/empty.gleam
···
1
1
+
+3
test-package-compiler/cases/javascript_empty/gleam.toml
···
1
1
+
name = "hello_joe"
2
2
+
version = "0.1.0"
3
3
+
target = "javascript"
+1
test-package-compiler/cases/javascript_empty/src/empty.gleam
···
1
1
+
+4
-1
test-package-compiler/src/lib.rs
···
49
49
}),
50
50
},
51
51
Target::JavaScript => TargetCodegenConfiguration::JavaScript {
52
52
-
emit_typescript_definitions: true,
52
52
+
emit_typescript_definitions: config.javascript.typescript_declarations,
53
53
},
54
54
};
55
55
···
99
99
buffer.push('\n');
100
100
101
101
match content {
102
102
+
_ if path.ends_with("gleam.mjs") || path.ends_with("gleam.d.ts") => {
103
103
+
buffer.push_str("<prelude>")
104
104
+
}
102
105
Content::Text(text) => buffer.push_str(text),
103
106
Content::Binary(data) => write!(buffer, "{:#?}", data).unwrap(),
104
107
};
+20
test-package-compiler/src/snapshots/test_package_compiler__generated_tests__erlang_empty.snap
···
1
1
+
---
2
2
+
source: test-package-compiler/src/generated_tests.rs
3
3
+
assertion_line: 7
4
4
+
expression: /Users/louis/src/gleam/gleam/test-package-compiler/cases/erlang_empty
5
5
+
---
6
6
+
//// /out/lib/the_package/_gleam_artefacts/empty.erl
7
7
+
-module(empty).
8
8
+
9
9
+
10
10
+
//// /out/lib/the_package/ebin/hello_joe.app
11
11
+
{application, hello_joe, [
12
12
+
{vsn, "0.1.0"},
13
13
+
{applications, []},
14
14
+
{description, ""},
15
15
+
{modules, [empty]},
16
16
+
{registered, []}
17
17
+
]}.
18
18
+
19
19
+
20
20
+
+13
test-package-compiler/src/snapshots/test_package_compiler__generated_tests__javascript_empty.snap
···
1
1
+
---
2
2
+
source: test-package-compiler/src/generated_tests.rs
3
3
+
assertion_line: 19
4
4
+
expression: /Users/louis/src/gleam/gleam/test-package-compiler/cases/javascript_empty
5
5
+
---
6
6
+
//// /out/lib/the_package/empty.mjs
7
7
+
export {}
8
8
+
9
9
+
10
10
+
//// /out/lib/the_package/gleam.mjs
11
11
+
<prelude>
12
12
+
13
13
+