diff options
author | Axetroy <axetroy.dev@gmail.com> | 2019-11-27 00:07:40 +0800 |
---|---|---|
committer | Ry Dahl <ry@tinyclouds.org> | 2019-11-26 08:07:39 -0800 |
commit | 2a348144c6932f749dfa28b6b8590d6df1c083f2 (patch) | |
tree | 778e1e289aa61056f188d346c92bf189d3b5bf50 /std/prettier/ignore_test.ts | |
parent | c016684653df45c3c3bc88d79dfc295ea5c6426f (diff) |
feat: add ignore parser for std/prettier (#3399)
Diffstat (limited to 'std/prettier/ignore_test.ts')
-rw-r--r-- | std/prettier/ignore_test.ts | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/std/prettier/ignore_test.ts b/std/prettier/ignore_test.ts new file mode 100644 index 000000000..05f67edf4 --- /dev/null +++ b/std/prettier/ignore_test.ts @@ -0,0 +1,81 @@ +// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. +import { test, runIfMain } from "../testing/mod.ts"; +import { assertEquals } from "../testing/asserts.ts"; +import { parse } from "./ignore.ts"; + +const testCases = [ + { + input: `# this is a comment +node_modules +`, + output: new Set(["node_modules"]) + }, + { + input: ` # invalid comment +`, + output: new Set([" # invalid comment"]) + }, + { + input: ` +node_modules +package.json +`, + output: new Set(["node_modules", "package.json"]) + }, + { + input: ` + node_modules + package.json +`, + output: new Set([" node_modules", " package.json"]) + }, + { + input: `*.orig +*.pyc +*.swp + +/.idea/ +/.vscode/ +gclient_config.py_entries +/gh-pages/ +/target/ + +# Files that help ensure VSCode can work but we don't want checked into the +# repo +/node_modules +/tsconfig.json + +# We use something stronger than lockfiles, we have all NPM modules stored in a +# git. We do not download from NPM during build. +# https://github.com/denoland/deno_third_party +yarn.lock +# yarn creates this in error. +tools/node_modules/ + `, + output: new Set([ + "*.orig", + "*.pyc", + "*.swp", + "/.idea/", + "/.vscode/", + "gclient_config.py_entries", + "/gh-pages/", + "/target/", + "/node_modules", + "/tsconfig.json", + "yarn.lock", + "tools/node_modules/" + ]) + } +]; + +test({ + name: "[encoding.ignore] basic", + fn(): void { + for (const { input, output } of testCases) { + assertEquals(parse(input), output); + } + } +}); + +runIfMain(import.meta); |