|
1 | 1 | import assert from "assert"; |
2 | 2 | import path from "path"; |
3 | 3 | import fs from "fs"; |
4 | | -import {diffString} from "json-diff"; |
5 | 4 | import {Resource} from "../syntax/grammar.js"; |
6 | | -import {PASS, FAIL} from "./util.js"; |
| 5 | +import {print_generic_error, print_assert_error, exit_summary, PASS, FAIL} |
| 6 | + from "./suite.js"; |
7 | 7 |
|
8 | 8 | const bail = process.argv[2] === "--bail"; |
9 | 9 | const fixtures_dir = process.argv[bail ? 3 : 2]; |
@@ -78,32 +78,3 @@ function validate(actual_ast, expected_serialized) { |
78 | 78 | const expected_json = JSON.parse(expected_serialized); |
79 | 79 | assert.deepEqual(actual_json, expected_json); |
80 | 80 | } |
81 | | - |
82 | | -function print_assert_error(ftl_path, err) { |
83 | | - console.log(` |
84 | | -======================================================================== |
85 | | -${FAIL} ${ftl_path} |
86 | | ------------------------------------------------------------------------- |
87 | | -${diffString(err.expected, err.actual)} |
88 | | -`); |
89 | | -} |
90 | | - |
91 | | -function print_generic_error(ftl_path, err) { |
92 | | - console.log(` |
93 | | -======================================================================== |
94 | | -${FAIL} ${ftl_path} |
95 | | ------------------------------------------------------------------------- |
96 | | -${err.message} |
97 | | -`); |
98 | | -} |
99 | | - |
100 | | -function exit_summary(error_count) { |
101 | | - const message = error_count |
102 | | - ? `Tests ${FAIL}: ${error_count}.` |
103 | | - : `All tests ${PASS}.`; |
104 | | - console.log(` |
105 | | -======================================================================== |
106 | | -${message} |
107 | | -`); |
108 | | - process.exit(Number(error_count > 0)); |
109 | | -} |
0 commit comments