2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2022-10-28 08:07:56 +00:00
|
|
|
|
2023-12-12 03:51:35 +00:00
|
|
|
import { extract } from "./any.ts";
|
2022-10-28 08:07:56 +00:00
|
|
|
import {
|
2024-05-28 01:14:52 +00:00
|
|
|
runExtractJsonTests,
|
|
|
|
runExtractTomlTests,
|
2022-10-28 08:07:56 +00:00
|
|
|
runExtractTypeErrorTests,
|
2024-05-28 01:14:52 +00:00
|
|
|
runExtractYamlTests1,
|
|
|
|
runExtractYamlTests2,
|
2022-10-28 08:07:56 +00:00
|
|
|
} from "./_test_utils.ts";
|
|
|
|
|
|
|
|
// YAML //
|
|
|
|
|
2024-02-27 08:35:41 +00:00
|
|
|
Deno.test("extract() extracts type error on invalid input", () => {
|
2023-12-12 03:51:35 +00:00
|
|
|
runExtractTypeErrorTests("yaml", extract);
|
2022-10-28 08:07:56 +00:00
|
|
|
});
|
|
|
|
|
2024-02-27 08:35:41 +00:00
|
|
|
Deno.test("extract() parses yaml delineate by `---`", async () => {
|
2024-05-28 01:14:52 +00:00
|
|
|
await runExtractYamlTests1(extract);
|
2022-10-28 08:07:56 +00:00
|
|
|
});
|
|
|
|
|
2024-02-27 08:35:41 +00:00
|
|
|
Deno.test("extract() parses yaml delineate by `---yaml`", async () => {
|
2024-05-28 01:14:52 +00:00
|
|
|
await runExtractYamlTests2(extract);
|
2022-10-28 08:07:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// JSON //
|
|
|
|
|
2024-02-27 08:35:41 +00:00
|
|
|
Deno.test("extract() extracts type error on invalid json input", () => {
|
2023-12-12 03:51:35 +00:00
|
|
|
runExtractTypeErrorTests("json", extract);
|
2022-10-28 08:07:56 +00:00
|
|
|
});
|
|
|
|
|
2024-02-27 08:35:41 +00:00
|
|
|
Deno.test("extract() parses json delineate by ---json", async () => {
|
2024-05-28 01:14:52 +00:00
|
|
|
await runExtractJsonTests(extract);
|
2022-10-28 08:07:56 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// TOML //
|
|
|
|
|
2024-02-27 08:35:41 +00:00
|
|
|
Deno.test("extract() extracts type error on invalid toml input", () => {
|
2023-12-12 03:51:35 +00:00
|
|
|
runExtractTypeErrorTests("toml", extract);
|
2022-10-28 08:07:56 +00:00
|
|
|
});
|
|
|
|
|
2024-02-27 08:35:41 +00:00
|
|
|
Deno.test("extract() parses toml delineate by ---toml", async () => {
|
2024-05-28 01:14:52 +00:00
|
|
|
await runExtractTomlTests(extract);
|
2022-10-28 08:07:56 +00:00
|
|
|
});
|