2022-01-20 02:10:16 -05:00
|
|
|
// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license.
|
2020-03-13 10:57:32 -04:00
|
|
|
|
2021-02-02 06:05:46 -05:00
|
|
|
import * as colors from "../../../test_util/std/fmt/colors.ts";
|
2020-06-12 11:58:04 -04:00
|
|
|
export { colors };
|
2021-02-02 06:05:46 -05:00
|
|
|
import { resolve } from "../../../test_util/std/path/mod.ts";
|
2019-03-06 20:48:46 -05:00
|
|
|
export {
|
|
|
|
assert,
|
2019-05-17 14:03:01 -04:00
|
|
|
assertEquals,
|
2019-08-27 11:33:39 -04:00
|
|
|
assertMatch,
|
2019-05-17 14:03:01 -04:00
|
|
|
assertNotEquals,
|
2021-09-05 16:43:46 -04:00
|
|
|
assertRejects,
|
2020-06-05 23:43:00 -04:00
|
|
|
assertStrictEquals,
|
2020-10-26 11:03:30 -04:00
|
|
|
assertStringIncludes,
|
2020-09-27 06:22:32 -04:00
|
|
|
assertThrows,
|
2020-03-28 13:03:49 -04:00
|
|
|
fail,
|
2021-02-22 07:26:17 -05:00
|
|
|
unimplemented,
|
2020-09-27 06:22:32 -04:00
|
|
|
unreachable,
|
2021-02-02 06:05:46 -05:00
|
|
|
} from "../../../test_util/std/testing/asserts.ts";
|
|
|
|
export { deferred } from "../../../test_util/std/async/deferred.ts";
|
2021-04-11 19:40:42 -04:00
|
|
|
export type { Deferred } from "../../../test_util/std/async/deferred.ts";
|
2021-06-24 21:44:14 -04:00
|
|
|
export { delay } from "../../../test_util/std/async/delay.ts";
|
2021-02-02 06:05:46 -05:00
|
|
|
export { readLines } from "../../../test_util/std/io/bufio.ts";
|
|
|
|
export { parse as parseArgs } from "../../../test_util/std/flags/mod.ts";
|
2018-08-23 19:47:43 -04:00
|
|
|
|
2020-06-11 12:36:20 -04:00
|
|
|
export function pathToAbsoluteFileUrl(path: string): URL {
|
|
|
|
path = resolve(path);
|
|
|
|
|
|
|
|
return new URL(`file://${Deno.build.os === "windows" ? "/" : ""}${path}`);
|
|
|
|
}
|
2022-03-11 11:18:49 -05:00
|
|
|
|
|
|
|
const decoder = new TextDecoder();
|
|
|
|
|
2022-03-22 23:04:20 -04:00
|
|
|
export async function execCode(code: string): Promise<[number, string]> {
|
2022-07-18 09:16:12 -04:00
|
|
|
const output = await Deno.spawn(Deno.execPath(), {
|
2022-05-18 16:00:11 -04:00
|
|
|
args: [
|
2022-03-11 11:18:49 -05:00
|
|
|
"eval",
|
|
|
|
"--unstable",
|
|
|
|
"--no-check",
|
|
|
|
code,
|
|
|
|
],
|
|
|
|
});
|
2022-07-18 09:16:12 -04:00
|
|
|
return [output.code, decoder.decode(output.stdout)];
|
2022-03-11 11:18:49 -05:00
|
|
|
}
|