diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2018-05-28 13:17:13 -0400 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2018-05-28 13:30:15 -0400 |
commit | 33f488354cf28e326d53e51edb50036005882933 (patch) | |
tree | a55f7d4c7a46181bed99cea050cdac497b8d537a /tests.ts | |
parent | 08d3850fa88df2319300874c701da1415b7372a0 (diff) |
Move testdata/read_file_sync.ts to tests.ts
We don't need to start a new process for every test.
Diffstat (limited to 'tests.ts')
-rw-r--r-- | tests.ts | 23 |
1 files changed, 20 insertions, 3 deletions
@@ -1,5 +1,22 @@ -import { test, assert } from "./deno_testing/testing.ts"; +// This test is executed as part of integration_test.go +// But it can also be run manually: +// ./deno tests.ts +import { test, assert, assertEqual } from "./deno_testing/testing.ts"; +import { readFileSync } from "deno"; -test(async function test_matchTesters() { - assert(false, "assert failed on purpose."); +test(async function tests_test() { + assert(true); +}); + +test(async function tests_readFileSync() { + let data = readFileSync("package.json"); + if (!data.byteLength) { + throw Error( + `Expected positive value for data.byteLength ${data.byteLength}` + ); + } + const decoder = new TextDecoder("utf-8"); + const json = decoder.decode(data); + const pkg = JSON.parse(json); + assertEqual(pkg.name, "deno"); }); |