mirror of
https://github.com/roc-lang/roc.git
synced 2025-11-01 05:24:15 +00:00
add load tests from ingested files
This commit is contained in:
parent
ff414610ca
commit
21d063da26
4 changed files with 60 additions and 0 deletions
5
crates/compiler/load_internal/tests/fixtures/build/interface_with_deps/IngestedFile.roc
vendored
Normal file
5
crates/compiler/load_internal/tests/fixtures/build/interface_with_deps/IngestedFile.roc
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
interface IngestedFile
|
||||
exposes [str]
|
||||
imports ["IngestedFile.roc" as foo : Str]
|
||||
|
||||
str = foo
|
||||
5
crates/compiler/load_internal/tests/fixtures/build/interface_with_deps/IngestedFileBytes.roc
vendored
Normal file
5
crates/compiler/load_internal/tests/fixtures/build/interface_with_deps/IngestedFileBytes.roc
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
interface IngestedFileBytes
|
||||
exposes [str]
|
||||
imports ["IngestedFileBytes.roc" as foo : List U8]
|
||||
|
||||
str = Str.fromUtf8 foo |> Result.withDefault ""
|
||||
8
crates/compiler/load_internal/tests/fixtures/build/no_deps/MissingIngestedFile.roc
vendored
Normal file
8
crates/compiler/load_internal/tests/fixtures/build/no_deps/MissingIngestedFile.roc
vendored
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
interface MissingIngestedFile
|
||||
exposes [unit]
|
||||
imports ["ThisFileIsMissing" as data: List U8]
|
||||
|
||||
Unit : [Unit]
|
||||
|
||||
unit : Unit
|
||||
unit = Unit
|
||||
|
|
@ -572,6 +572,34 @@ fn imported_dep_regression() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ingested_file() {
|
||||
let subs_by_module = Default::default();
|
||||
let loaded_module = load_fixture("interface_with_deps", "IngestedFile", subs_by_module);
|
||||
|
||||
expect_types(
|
||||
loaded_module,
|
||||
hashmap! {
|
||||
"foo" => "Str",
|
||||
"str" => "Str",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn ingested_file_bytes() {
|
||||
let subs_by_module = Default::default();
|
||||
let loaded_module = load_fixture("interface_with_deps", "IngestedFileBytes", subs_by_module);
|
||||
|
||||
expect_types(
|
||||
loaded_module,
|
||||
hashmap! {
|
||||
"foo" => "List U8",
|
||||
"str" => "Str",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parse_problem() {
|
||||
let modules = vec![(
|
||||
|
|
@ -639,6 +667,20 @@ fn imported_file_not_found() {
|
|||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[should_panic(expected = "FILE NOT FOUND")]
|
||||
fn ingested_file_not_found() {
|
||||
let subs_by_module = Default::default();
|
||||
let loaded_module = load_fixture("no_deps", "MissingIngestedFile", subs_by_module);
|
||||
|
||||
expect_types(
|
||||
loaded_module,
|
||||
hashmap! {
|
||||
"str" => "Str",
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn platform_does_not_exist() {
|
||||
let modules = vec![(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue