dev: test libraries in CI (#69)

* fix: canonicalize line feed for testing

* dev: test libraries in CI

* build: remove wrapper
This commit is contained in:
Myriad-Dreamin 2024-03-23 09:16:32 +08:00 committed by GitHub
parent 0cdbeaa38b
commit 81ed159e90
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
27 changed files with 87 additions and 79 deletions

View file

@ -13,7 +13,7 @@ input_file: crates/tinymist-query/src/fixtures/def_use/base.typ
"range": "5:6"
},
"refs": [
"x@14..15"
"x@13..14"
]
}
}

View file

@ -4,13 +4,13 @@ expression: "JsonRepr::new_redacted(result, &REDACT_LOC)"
input_file: crates/tinymist-query/src/fixtures/def_use/base2.typ
---
{
"y@28..29@s0.typ": {
"y@27..28@s0.typ": {
"def": {
"kind": {
"Var": "Variable"
},
"name": "y",
"range": "28:29"
"range": "27:28"
},
"refs": []
}

View file

@ -13,20 +13,20 @@ input_file: crates/tinymist-query/src/fixtures/def_use/import_alias.typ
"range": "8:18"
},
"refs": [
"base@21..25",
"base@55..59"
"base@20..24",
"base@52..56"
]
},
"foo@49..52@s0.typ": {
"foo@47..50@s0.typ": {
"def": {
"kind": {
"Mod": "ModuleAlias"
},
"name": "foo",
"range": "49:52"
"range": "47:50"
},
"refs": [
"foo@62..65"
"foo@59..62"
]
}
}

View file

@ -13,34 +13,34 @@ input_file: crates/tinymist-query/src/fixtures/def_use/import_alias_both.typ
"range": "8:18"
},
"refs": [
"base@21..25",
"base@65..69"
"base@20..24",
"base@62..66"
]
},
"foo@49..52@s0.typ": {
"foo@47..50@s0.typ": {
"def": {
"kind": {
"Mod": "ModuleAlias"
},
"name": "foo",
"range": "49:52"
"range": "47:50"
},
"refs": []
},
"foo@59..62@s0.typ": {
"foo@57..60@s0.typ": {
"def": {
"kind": {
"Mod": {
"Alias": {
"target": "x@54..55"
"target": "x@52..53"
}
}
},
"name": "foo",
"range": "59:62"
"range": "57:60"
},
"refs": [
"foo@72..75"
"foo@69..72"
]
}
}

View file

@ -13,20 +13,20 @@ input_file: crates/tinymist-query/src/fixtures/def_use/import_ident.typ
"range": "8:18"
},
"refs": [
"base@21..25",
"base@51..55"
"base@20..24",
"base@48..52"
]
},
"x@47..48@s0.typ": {
"x@45..46@s0.typ": {
"def": {
"kind": {
"Mod": "Ident"
},
"name": "x",
"range": "47:48"
"range": "45:46"
},
"refs": [
"x@58..59"
"x@55..56"
]
}
}

View file

@ -13,24 +13,24 @@ input_file: crates/tinymist-query/src/fixtures/def_use/import_ident_alias.typ
"range": "8:18"
},
"refs": [
"base@21..25",
"base@58..62"
"base@20..24",
"base@55..59"
]
},
"foo@52..55@s0.typ": {
"foo@50..53@s0.typ": {
"def": {
"kind": {
"Mod": {
"Alias": {
"target": "x@47..48"
"target": "x@45..46"
}
}
},
"name": "foo",
"range": "52:55"
"range": "50:53"
},
"refs": [
"foo@65..68"
"foo@62..65"
]
}
}

View file

@ -13,8 +13,8 @@ input_file: crates/tinymist-query/src/fixtures/def_use/import_star.typ
"range": "8:18"
},
"refs": [
"base@21..25",
"base@51..55"
"base@20..24",
"base@48..52"
]
},
"x@5..6@base.typ": {
@ -26,7 +26,7 @@ input_file: crates/tinymist-query/src/fixtures/def_use/import_star.typ
"range": "5:6"
},
"refs": [
"x@58..59"
"x@55..56"
]
}
}

View file

@ -13,19 +13,19 @@ input_file: crates/tinymist-query/src/fixtures/def_use/import_star_recursive.typ
"range": "5:6"
},
"refs": [
"x@25..26"
"x@24..25"
]
},
"y@28..29@base2.typ": {
"y@27..28@base2.typ": {
"def": {
"kind": {
"Var": "Variable"
},
"name": "y",
"range": "28:29"
"range": "27:28"
},
"refs": [
"y@29..30"
"y@28..29"
]
}
}

View file

@ -25,7 +25,7 @@ input_file: crates/tinymist-query/src/fixtures/def_use/param_scope.typ
"range": "5:9"
},
"refs": [
"term@26..30"
"term@25..29"
]
}
}

View file

@ -13,7 +13,7 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/base.typ
"range": "5:6"
},
"refs": [
"x@14..15"
"x@13..14"
]
}
}

View file

@ -4,13 +4,13 @@ expression: "JsonRepr::new_redacted(result, &REDACT_LOC)"
input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/destructing.typ
---
{
"a@29..30@s0.typ": {
"a@28..29@s0.typ": {
"def": {
"kind": {
"Var": "Variable"
},
"name": "a",
"range": "29:30"
"range": "28:29"
},
"refs": []
},
@ -23,16 +23,16 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/destructing.typ
"range": "6:7"
},
"refs": [
"a@41..42"
"a@40..41"
]
},
"b@32..33@s0.typ": {
"b@31..32@s0.typ": {
"def": {
"kind": {
"Var": "Variable"
},
"name": "b",
"range": "32:33"
"range": "31:32"
},
"refs": []
},
@ -45,7 +45,7 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/destructing.typ
"range": "9:10"
},
"refs": [
"b@38..39"
"b@37..38"
]
}
}

View file

@ -4,13 +4,13 @@ expression: "JsonRepr::new_redacted(result, &REDACT_LOC)"
input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/dict.typ
---
{
"x@18..19@s0.typ": {
"x@17..18@s0.typ": {
"def": {
"kind": {
"Var": "Variable"
},
"name": "x",
"range": "18:19"
"range": "17:18"
},
"refs": []
},
@ -23,8 +23,8 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/dict.typ
"range": "5:6"
},
"refs": [
"z@30..31",
"z@43..44"
"z@28..29",
"z@40..41"
]
}
}

View file

@ -4,25 +4,25 @@ expression: "JsonRepr::new_redacted(result, &REDACT_LOC)"
input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/func.typ
---
{
"a@20..21@s0.typ": {
"a@19..20@s0.typ": {
"def": {
"kind": {
"Var": "Variable"
},
"name": "a",
"range": "20:21"
"range": "19:20"
},
"refs": [
"a@25..26"
"a@24..25"
]
},
"f@18..19@s0.typ": {
"f@17..18@s0.typ": {
"def": {
"kind": {
"Var": "Function"
},
"name": "f",
"range": "18:19"
"range": "17:18"
},
"refs": []
},

View file

@ -13,7 +13,7 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/import.typ
"range": "8:18"
},
"refs": [
"base@21..25"
"base@20..24"
]
}
}

View file

@ -4,13 +4,13 @@ expression: "JsonRepr::new_redacted(result, &REDACT_LOC)"
input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/redefine.typ
---
{
"x@18..19@s0.typ": {
"x@17..18@s0.typ": {
"def": {
"kind": {
"Var": "Variable"
},
"name": "x",
"range": "18:19"
"range": "17:18"
},
"refs": []
},
@ -23,7 +23,7 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/redefine.typ
"range": "5:6"
},
"refs": [
"x@22..23"
"x@21..22"
]
}
}

View file

@ -16,6 +16,6 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/base.typ
"Var": "ValRef"
},
"name": "x",
"range": "14:15"
"range": "13:14"
}
]

View file

@ -23,27 +23,27 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/destructing.typ
"Var": "ValRef"
},
"name": "b",
"range": "38:39"
"range": "37:38"
},
{
"kind": {
"Var": "ValRef"
},
"name": "a",
"range": "41:42"
"range": "40:41"
},
{
"kind": {
"Var": "Variable"
},
"name": "a",
"range": "29:30"
"range": "28:29"
},
{
"kind": {
"Var": "Variable"
},
"name": "b",
"range": "32:33"
"range": "31:32"
}
]

View file

@ -16,20 +16,20 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/dict.typ
"Var": "ValRef"
},
"name": "z",
"range": "30:31"
"range": "28:29"
},
{
"kind": {
"Var": "ValRef"
},
"name": "z",
"range": "43:44"
"range": "40:41"
},
{
"kind": {
"Var": "Variable"
},
"name": "x",
"range": "18:19"
"range": "17:18"
}
]

View file

@ -16,7 +16,7 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/func.typ
"Var": "Function"
},
"name": "f",
"range": "18:19"
"range": "17:18"
},
{
"children": [
@ -25,18 +25,18 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/func.typ
"Var": "Variable"
},
"name": "a",
"range": "20:21"
"range": "19:20"
},
{
"kind": {
"Var": "ValRef"
},
"name": "a",
"range": "25:26"
"range": "24:25"
}
],
"kind": "Block",
"name": "",
"range": "25:26"
"range": "24:25"
}
]

View file

@ -29,6 +29,6 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/import.typ
"Var": "ValRef"
},
"name": "base",
"range": "21:25"
"range": "20:24"
}
]

View file

@ -16,13 +16,13 @@ input_file: crates/tinymist-query/src/fixtures/lexical_hierarchy/redefine.typ
"Var": "ValRef"
},
"name": "x",
"range": "22:23"
"range": "21:22"
},
{
"kind": {
"Var": "Variable"
},
"name": "x",
"range": "18:19"
"range": "17:18"
}
]

View file

@ -3,4 +3,4 @@ source: crates/tinymist-query/src/semantic_tokens_full.rs
expression: "serde_json::to_string(&result).unwrap()"
input_file: crates/tinymist-query/src/fixtures/semantic_tokens/content-block.typ
---
{"data":[0,0,1,8,0,0,1,1,8,0,0,1,1,8,0,0,1,2,20,0,1,0,0,20,0,0,0,1,8,0,0,1,1,8,0,0,1,1,20,0,0,1,1,8,0,0,1,2,20,0,1,0,0,20,0,0,0,1,8,0,0,1,1,8,0,0,1,1,8,0,0,1,1,8,0,0,1,1,20,0,0,1,1,8,0,0,1,1,8,0,0,1,1,8,0,0,1,1,8,0,0,1,1,8,0,0,1,3,20,0,0,3,1,8,0,0,1,1,8,0,0,1,1,8,0]}
{"data":[0,0,1,8,0,0,1,1,8,0,0,1,1,8,0,0,1,1,20,0,1,0,0,20,0,0,0,1,8,0,0,1,1,8,0,0,1,1,20,0,0,1,1,8,0,0,1,1,20,0,1,0,0,20,0,0,0,1,8,0,0,1,1,8,0,0,1,1,8,0,0,1,1,8,0,0,1,1,20,0,0,1,1,8,0,0,1,1,8,0,0,1,1,8,0,0,1,1,8,0,0,1,1,8,0,0,1,3,20,0,0,3,1,8,0,0,1,1,8,0,0,1,1,8,0]}

View file

@ -3,4 +3,4 @@ source: crates/tinymist-query/src/semantic_tokens_full.rs
expression: "serde_json::to_string(&result).unwrap()"
input_file: crates/tinymist-query/src/fixtures/semantic_tokens/fn2.typ
---
{"data":[0,0,1,2,0,0,1,3,2,0,0,3,1,20,0,0,1,2,5,0,0,2,1,8,0,0,1,1,8,0,0,1,1,20,0,0,1,1,3,0,0,1,1,20,0,0,1,1,8,0,0,1,2,20,0,1,0,2,20,0,0,2,3,5,0,0,3,1,8,0,0,1,7,1,0,0,7,1,8,0,0,1,1,20,0,0,1,4,18,0,0,4,1,8,0,0,1,1,20,0,0,1,5,1,0,0,5,1,8,0,0,1,2,20,0,1,0,2,20,0,0,2,3,20,0,0,0,3,11,0,0,3,3,20,0,0,0,3,11,0,0,3,2,20,0,1,0,2,20,0,0,2,1,20,0,0,0,1,11,0,0,1,2,20,0,1,0,2,20,0,0,2,1,20,0,0,0,1,11,0,0,1,2,20,0,1,0,2,20,0,0,2,3,20,0,0,0,3,11,0,0,3,2,20,0,1,0,2,20,0,0,2,1,8,0,0,1,1,20,0,0,1,1,8,0,0,1,2,20,0,1,0,0,20,0,0,0,1,8,0]}
{"data":[0,0,1,2,0,0,1,3,2,0,0,3,1,20,0,0,1,2,5,0,0,2,1,8,0,0,1,1,8,0,0,1,1,20,0,0,1,1,3,0,0,1,1,20,0,0,1,1,8,0,0,1,1,20,0,1,0,2,20,0,0,2,3,5,0,0,3,1,8,0,0,1,7,1,0,0,7,1,8,0,0,1,1,20,0,0,1,4,18,0,0,4,1,8,0,0,1,1,20,0,0,1,5,1,0,0,5,1,8,0,0,1,1,20,0,1,0,2,20,0,0,2,3,20,0,0,0,3,11,0,0,3,3,20,0,0,0,3,11,0,0,3,1,20,0,1,0,2,20,0,0,2,1,20,0,0,0,1,11,0,0,1,1,20,0,1,0,2,20,0,0,2,1,20,0,0,0,1,11,0,0,1,1,20,0,1,0,2,20,0,0,2,3,20,0,0,0,3,11,0,0,3,1,20,0,1,0,2,20,0,0,2,1,8,0,0,1,1,20,0,0,1,1,8,0,0,1,1,20,0,1,0,0,20,0,0,0,1,8,0]}

View file

@ -3,4 +3,4 @@ source: crates/tinymist-query/src/semantic_tokens_full.rs
expression: "serde_json::to_string(&result).unwrap()"
input_file: crates/tinymist-query/src/fixtures/semantic_tokens/typst_lsp_issue_264.typ
---
{"data":[0,0,4,0,0,1,0,5,0,0,1,0,4,0,0,1,0,2,0,0,0,2,2,20,0,1,0,2,20,0,1,0,0,20,0,0,0,3,20,0,0,0,3,11,0,0,3,4,20,0,0,0,4,11,0,0,4,2,20,0,1,0,0,20,0,0,0,17,20,0,0,0,17,11,0,0,17,2,20,0,1,0,0,20,0,0,0,3,20,0,0,0,3,11,0]}
{"data":[0,0,3,0,0,1,0,4,0,0,1,0,3,0,0,1,0,2,0,0,0,2,1,20,0,1,0,1,20,0,1,0,0,20,0,0,0,3,20,0,0,0,3,11,0,0,3,4,20,0,0,0,4,11,0,0,4,1,20,0,1,0,0,20,0,0,0,17,20,0,0,0,17,11,0,0,17,1,20,0,1,0,0,20,0,0,0,3,20,0,0,0,3,11,0]}

View file

@ -3,4 +3,4 @@ source: crates/tinymist-query/src/semantic_tokens_full.rs
expression: "serde_json::to_string(&result).unwrap()"
input_file: crates/tinymist-query/src/fixtures/semantic_tokens/typst_lsp_issue_401.typ
---
{"data":[0,0,1,1,0,0,1,7,1,0,1,0,2,1,0,1,0,6,1,0]}
{"data":[0,0,1,1,0,0,1,6,1,0,1,0,1,1,0,1,0,6,1,0]}

View file

@ -32,6 +32,8 @@ pub fn snapshot_testing(name: &str, f: &impl Fn(&mut AnalysisContext, PathBuf))
let glob_path = format!("fixtures/{name}/*.typ");
insta::glob!(&glob_path, |path| {
let contents = std::fs::read_to_string(path).unwrap();
#[cfg(windows)]
let contents = contents.replace("\r\n", "\n");
run_with_sources(&contents, |w: &mut TypstSystemWorld, p| {
let paths = w