-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from harlanj/master
Move assert function to common.js file in test dir
- Loading branch information
Showing
8 changed files
with
23 additions
and
48 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,6 @@ | ||
function assert(thing, message) { | ||
if (thing) return; | ||
throw new Error(message); | ||
} | ||
|
||
return assert |
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
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 |
---|---|---|
@@ -1,8 +1,3 @@ | ||
|
||
function assert(thing, message) { | ||
if (thing) return | ||
|
||
throw new Error(message) | ||
} | ||
var assert = nucleus.dofile("./common/assert.js") | ||
|
||
assert(nucleus.dofile("../fixtures/a.js") === 'a', "a.js should expose 'a'") |
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 |
---|---|---|
@@ -1,36 +1,31 @@ | ||
|
||
function assert(thing, message) { | ||
if (thing) return | ||
|
||
throw new Error(message) | ||
} | ||
var assert = nucleus.dofile("./common/assert.js") | ||
|
||
// get non-existing | ||
assert(nucleus.getenv('__NUCLEUS_TEST') === null) | ||
assert(nucleus.getenv('__NUCLEUS_TEST') === null, 'nonexisting env var should be `null`') | ||
|
||
// set new | ||
assert(nucleus.setenv('__NUCLEUS_TEST', 'nice day @nodeconf') === undefined) | ||
assert(nucleus.setenv('__NUCLEUS_TEST', 'nice day @nodeconf') === undefined, 'setenv should return `undefined`') | ||
|
||
// get newly set | ||
assert(nucleus.getenv('__NUCLEUS_TEST') === 'nice day @nodeconf') | ||
assert(nucleus.getenv('__NUCLEUS_TEST') === 'nice day @nodeconf', 'getenv should return value') | ||
|
||
// newly set in envkeys | ||
assert(nucleus.envkeys().indexOf('__NUCLEUS_TEST') !== -1) | ||
assert(nucleus.envkeys().indexOf('__NUCLEUS_TEST') !== -1, 'env variable should be set in envkeys') | ||
|
||
// re-set | ||
assert(nucleus.setenv('__NUCLEUS_TEST', 'hi there') === undefined) | ||
assert(nucleus.setenv('__NUCLEUS_TEST', 'hi there') === undefined, 'setenv should return `undefined`') | ||
|
||
// get re-set | ||
assert(nucleus.getenv('__NUCLEUS_TEST') === 'hi there') | ||
assert(nucleus.getenv('__NUCLEUS_TEST') === 'hi there', 'get existing key should return `hi there`') | ||
|
||
// re-set in envkeys | ||
assert(nucleus.envkeys().indexOf('__NUCLEUS_TEST') !== -1) | ||
assert(nucleus.envkeys().indexOf('__NUCLEUS_TEST') !== -1, 'env variable should be set in envkeys') | ||
|
||
// unset | ||
assert(nucleus.unsetenv('__NUCLEUS_TEST') === undefined) | ||
assert(nucleus.unsetenv('__NUCLEUS_TEST') === undefined, 'setenv should return `undefined`') | ||
|
||
// get now non-existing | ||
assert(nucleus.getenv('__NUCLEUS_TEST') === null) | ||
assert(nucleus.getenv('__NUCLEUS_TEST') === null, 'nonexisting env var should be `null`') | ||
|
||
// no longer in envkeys | ||
assert(nucleus.envkeys().indexOf('__NUCLEUS_TEST') === -1) | ||
assert(nucleus.envkeys().indexOf('__NUCLEUS_TEST') === -1, 'env variable should be set in envkeys') |
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 |
---|---|---|
@@ -1,7 +1,3 @@ | ||
function assert(thing, message) { | ||
if (thing) return | ||
|
||
throw new Error(message) | ||
} | ||
var assert = nucleus.dofile("./common/assert.js") | ||
|
||
assert(nucleus.pathjoin('a', 'b', 'c') === 'a/b/c', 'pathjoin must work') |
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
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
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