Skip to content

Commit

Permalink
fix skip panic test for native
Browse files Browse the repository at this point in the history
  • Loading branch information
Young-Flash committed Jan 26, 2025
1 parent 258dd9e commit f1ae8e9
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
4 changes: 4 additions & 0 deletions crates/moonbuild/src/runtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,10 @@ async fn run(
let mut ts: TestStatistics = serde_json_lenient::from_str(s.trim())
.context(format!("failed to parse test summary: {}", s))?;

if ts.message == "skipped test" {
continue;
}

if ts.filename.contains(MOON_DOC_TEST_POSTFIX) {
ts.is_doc_test = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ pub fn moonbit_test_driver_internal_execute() -> Unit {
for filename, index_func_map in moonbit_test_driver_internal_no_args_tests {
for index, pair in index_func_map {
let (func, attrs) = (pair.0, pair.1)
if attrs.iter().any(fn(attr) -> Bool {
attr.length() >= 5 && attr[0] == 'p' && attr[1] == 'a' && attr[2] == 'n' && attr[3] == 'i' && attr[4] == 'c'
}) {
@moonbitlang/core/builtin.println("skipped test block: \{filename}: \{attrs[0]}")
continue
}

let name = if attrs.is_empty() { "" } else { attrs[0] }
let name = if name.length() == 0 {
Expand All @@ -30,6 +24,18 @@ pub fn moonbit_test_driver_internal_execute() -> Unit {
name
}

if attrs.iter().any(fn(attr) -> Bool {
attr.length() >= 5 && attr[0] == 'p' && attr[1] == 'a' && attr[2] == 'n' && attr[3] == 'i' && attr[4] == 'c'
}) {
@moonbitlang/core/builtin.println("skipped test block: \{filename}: \{attrs[0]}")
@moonbitlang/core/builtin.println("{BEGIN_MOONTEST}")
@moonbitlang/core/builtin.println(
"{\"package\": \"{PACKAGE}\", \"filename\": \{filename.escape()}, \"index\": \"\{index}\", \"test_name\": \{name.escape()}, \"message\": \"skipped test\"}",
)
@moonbitlang/core/builtin.println("{END_MOONTEST}")
continue
}

let mut message = ""
try {
func!()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ pub fn moonbit_test_driver_internal_execute() -> Unit {
name
}

if attrs.iter().any(fn(attr) -> Bool {
attr.length() >= 5 && attr[0] == 'p' && attr[1] == 'a' && attr[2] == 'n' && attr[3] == 'i' && attr[4] == 'c'
}) {
@moonbitlang/core/builtin.println("skipped test block: \{file_name}: \{attrs[0]}")
@moonbitlang/core/builtin.println("{BEGIN_MOONTEST}")
@moonbitlang/core/builtin.println(
"{\"package\": \"{PACKAGE}\", \"filename\": \{file_name.escape()}, \"index\": \"\{index}\", \"test_name\": \{name.escape()}, \"message\": \"skipped test\"}",
)
@moonbitlang/core/builtin.println("{END_MOONTEST}")
continue
}

try {
let func = match item.f {
Moonbit_Test_Driver_Internal__F::F0(f) => f
Expand Down

0 comments on commit f1ae8e9

Please sign in to comment.