Skip to content

Commit

Permalink
origin test
Browse files Browse the repository at this point in the history
  • Loading branch information
Acepie authored and lpil committed Apr 26, 2024
1 parent eb7c931 commit b1d4884
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion compiler-core/src/metadata/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ fn module_with_type_links() {
}

#[test]
fn module_with_type_documentation() {
fn module_with_type_constructor_documentation() {
let linked_type = type_::link(type_::int());
let type_ = type_::int();

Expand Down Expand Up @@ -382,6 +382,46 @@ fn module_with_type_documentation() {
assert_eq!(roundtrip(&make(linked_type)), make(type_));
}

#[test]
fn module_with_type_constructor_origin() {
let linked_type = type_::link(type_::int());
let type_ = type_::int();

fn make(type_: Arc<Type>) -> ModuleInterface {
ModuleInterface {
is_internal: false,
contains_todo: false,
package: "some_package".into(),
origin: Origin::Src,
name: "a".into(),
types: [(
"SomeType".into(),
TypeConstructor {
typ: type_,
publicity: Publicity::Public,
origin: SrcSpan {
start: 535,
end: 543,
},
module: "a".into(),
parameters: vec![],
deprecation: Deprecation::NotDeprecated,
documentation: None,
},
)]
.into(),
types_value_constructors: HashMap::new(),
values: HashMap::new(),
unused_imports: Vec::new(),
accessors: HashMap::new(),
line_numbers: LineNumbers::new(""),
src_path: "some_path".into(),
}
}

assert_eq!(roundtrip(&make(linked_type)), make(type_));
}

#[test]
fn module_type_to_constructors_mapping() {
let module = ModuleInterface {
Expand Down

0 comments on commit b1d4884

Please sign in to comment.