|
1 | 1 | use std::ffi::OsStr; |
2 | | -use std::process::Command; |
3 | 2 |
|
4 | 3 | use quickjs_oxide::{Runtime, Value}; |
5 | 4 |
|
@@ -457,42 +456,8 @@ fn rust_observation(case: &Case) -> String { |
457 | 456 | } |
458 | 457 |
|
459 | 458 | fn oracle_observation(oracle: &OsStr, case: &Case) -> String { |
460 | | - let wrapper = r#" |
461 | | -try { |
462 | | - var value = std.evalScript(scriptArgs[0]); |
463 | | - print('return|' + typeof value + '|' + String(value)); |
464 | | -} catch (error) { |
465 | | - if (error !== null && typeof error === 'object') |
466 | | - print('throw|object|' + error.name + '|' + error.message); |
467 | | - else |
468 | | - print('throw|' + typeof error + '|' + String(error)); |
469 | | -} |
470 | | -"#; |
471 | | - let output = Command::new(oracle) |
472 | | - .args(["--std", "-e", wrapper, case.source]) |
473 | | - .output() |
474 | | - .unwrap_or_else(|error| { |
475 | | - panic!( |
476 | | - "could not run QuickJS for {} / {}: {error}", |
477 | | - case.group, case.description, |
478 | | - ) |
479 | | - }); |
480 | | - assert!( |
481 | | - output.status.success(), |
482 | | - "QuickJS observer failed for {} / {}: {}", |
483 | | - case.group, |
484 | | - case.description, |
485 | | - String::from_utf8_lossy(&output.stderr), |
486 | | - ); |
487 | | - String::from_utf8(output.stdout) |
488 | | - .unwrap_or_else(|error| { |
489 | | - panic!( |
490 | | - "QuickJS output was not UTF-8 for {} / {}: {error}", |
491 | | - case.group, case.description, |
492 | | - ) |
493 | | - }) |
494 | | - .trim_end() |
495 | | - .to_owned() |
| 459 | + let description = format!("{} / {}", case.group, case.description); |
| 460 | + super::quickjs_completion::observe(oracle, case.source, &description) |
496 | 461 | } |
497 | 462 |
|
498 | 463 | fn value_type(runtime: &Runtime, value: &Value) -> &'static str { |
|
0 commit comments