summaryrefslogtreecommitdiff
path: root/toml/parser_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'toml/parser_test.ts')
-rw-r--r--toml/parser_test.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/toml/parser_test.ts b/toml/parser_test.ts
index 03c733714..4b53945f4 100644
--- a/toml/parser_test.ts
+++ b/toml/parser_test.ts
@@ -1,10 +1,20 @@
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license.
import { test } from "../testing/mod.ts";
import { assertEquals } from "../testing/asserts.ts";
-import { parseFile, stringify } from "./parser.ts";
+import { existsSync } from "../fs/exists.ts";
+import { readFileStrSync } from "../fs/read_file_str.ts";
+import { parse, stringify } from "./parser.ts";
import * as path from "../fs/path/mod.ts";
const testFilesDir = path.resolve("toml", "testdata");
+function parseFile(filePath: string): object {
+ if (!existsSync(filePath)) {
+ throw new Error(`File not found: ${filePath}`);
+ }
+ const strFile = readFileStrSync(filePath);
+ return parse(strFile);
+}
+
test({
name: "[TOML] Strings",
fn(): void {