diff options
| author | Jimmy Cao <jcao2462@gmail.com> | 2019-04-25 15:47:18 -0700 |
|---|---|---|
| committer | Ryan Dahl <ry@tinyclouds.org> | 2019-04-25 16:47:18 -0600 |
| commit | 3bee6de208618fcea9cf07ead22e3d5ca1cfd200 (patch) | |
| tree | 81362dba6c82eef9bc1d0dc4eb10a3bb38371315 /toml/parser_test.ts | |
| parent | 146928dcf5ade24590d2a1ac14158c22c75fa73c (diff) | |
toml: remove parseFile (denoland/deno_std#361)
Original: https://github.com/denoland/deno_std/commit/0431b2f92fba69582f4412bfe9ad138838f46275
Diffstat (limited to 'toml/parser_test.ts')
| -rw-r--r-- | toml/parser_test.ts | 12 |
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 { |
