-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"use strict"; | ||
|
||
var test = require('tape'); | ||
var isRegex = require('./'); | ||
|
||
test('not regexes', function (t) { | ||
t.notOk(isRegex(), 'undefined is not regex'); | ||
t.notOk(isRegex(null), 'null is not regex'); | ||
t.notOk(isRegex(false), 'false is not regex'); | ||
t.notOk(isRegex(true), 'true is not regex'); | ||
t.notOk(isRegex(42), 'number is not regex'); | ||
t.notOk(isRegex('foo'), 'string is not regex'); | ||
t.notOk(isRegex([]), 'array is not regex'); | ||
t.notOk(isRegex({}), 'object is not regex'); | ||
t.notOk(isRegex(function () {}), 'function is not regex'); | ||
t.end(); | ||
}); | ||
|
||
test('regexes', function (t) { | ||
t.ok(isRegex(/a/g), 'regex literal is regex'); | ||
t.ok(isRegex(new RegExp('a', 'g')), 'regex object is regex'); | ||
t.end(); | ||
}); | ||
|