From 4e75dc7afa40a7c2039fd8bcb0865819eeadc007 Mon Sep 17 00:00:00 2001 From: Glen Date: Sun, 10 Jan 2016 13:12:55 +0200 Subject: [PATCH] Improve tests --- micromatch/micromatch-tests.ts | 27 ++++++++++++++++--------- parse-glob/parse-glob-tests.ts | 37 ++++++++++++++++++---------------- 2 files changed, 38 insertions(+), 26 deletions(-) diff --git a/micromatch/micromatch-tests.ts b/micromatch/micromatch-tests.ts index 8452acdcbc..7cf5e1eab4 100644 --- a/micromatch/micromatch-tests.ts +++ b/micromatch/micromatch-tests.ts @@ -1,32 +1,41 @@ /// import mm = require('micromatch'); +var result: string[]; +var boolResult: boolean; +var regExpResult: RegExp; + // Usage. -mm(['a.js', 'b.md', 'c.txt'], '*.{js,txt}'); +result = mm(['a.js', 'b.md', 'c.txt'], '*.{js,txt}'); // Multiple patterns. -mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.md', '*.txt']); +result = mm(['a.md', 'b.js', 'c.txt', 'd.json'], ['*.md', '*.txt']); // "isMatch" method. -mm.isMatch('.verb.md', '*.md'); -mm.isMatch('.verb.md', '*.md', {dot: true}); -mm.isMatch('.verb.md', {dot: true}); +boolResult = mm.isMatch('.verb.md', '*.md'); +boolResult = mm.isMatch('.verb.md', '*.md', {dot: true}); +boolResult = mm.isMatch('*.md', {dot: true})('.verb.md'); // "contains" method. -mm.contains('a/b/c', 'a/b'); +boolResult = mm.contains('a/b/c', 'a/b'); +boolResult = mm.contains('a/b/c', 'a/b', {dot: true}); // "matcher" method. var isMatch = mm.matcher('*.md'); // "filter" method. var fn = mm.filter('*.md'); +var fn = mm.filter('*.md', {dot: true}); // "any" method. -mm.any('abc', ['!*z']); -mm.any('abc', 'a*'); +boolResult = mm.any('abc', ['!*z']); +boolResult = mm.any('abc', 'a*'); +boolResult = mm.any('abc', 'a*', {dot: true}); // "expand" method. mm.expand('*.js'); +mm.expand('*.js', {dot: true}); // "makeRe" method. -mm.makeRe('*.js'); +regExpResult = mm.makeRe('*.js'); +regExpResult = mm.makeRe('*.js', {dot: true}); diff --git a/parse-glob/parse-glob-tests.ts b/parse-glob/parse-glob-tests.ts index 9a6697e3e3..a1b10c7e17 100644 --- a/parse-glob/parse-glob-tests.ts +++ b/parse-glob/parse-glob-tests.ts @@ -1,21 +1,24 @@ /// import parseGlob = require('parse-glob'); -var result = parseGlob('a/b/c/**/*.{yml,json}'); +var result: ParseGlob.Result = parseGlob('a/b/c/**/*.{yml,json}'); -result.base; -result.glob; -result.is.braces; -result.is.brackets; -result.is.dotdir; -result.is.dotfile; -result.is.extglob; -result.is.glob; -result.is.globstar; -result.is.negated; -result.orig; -result.path.basename; -result.path.dirname; -result.path.ext; -result.path.extname; -result.path.filename; +var stringValue: string; +var boolValue: boolean; + +stringValue = result.base; +stringValue = result.glob; +boolValue = result.is.braces; +boolValue = result.is.brackets; +boolValue = result.is.dotdir; +boolValue = result.is.dotfile; +boolValue = result.is.extglob; +boolValue = result.is.glob; +boolValue = result.is.globstar; +boolValue = result.is.negated; +stringValue = result.orig; +stringValue = result.path.basename; +stringValue = result.path.dirname; +stringValue = result.path.ext; +stringValue = result.path.extname; +stringValue = result.path.filename;