forked from inspector-ambitious/hammerjs
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
Ariya Hidayat
committed
Apr 14, 2011
1 parent
6503620
commit 70168ca
Showing
1 changed file
with
45 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,45 @@ | ||
/*global system:true, fs:true, Reflect:true */ | ||
system.print('Running unit tests for HammerJS...'); | ||
|
||
var total = 0; | ||
|
||
function assert(passed) { | ||
total += 1; | ||
if (!passed) { | ||
throw new Error('Test FAILS'); | ||
} | ||
} | ||
|
||
function test_fs() { | ||
assert(typeof fs === 'function'); | ||
assert(typeof fs.exists === 'function'); | ||
assert(typeof fs.isDirectory === 'function'); | ||
assert(typeof fs.isFile === 'function'); | ||
assert(typeof fs.makeDirectory === 'function'); | ||
assert(typeof fs.list === 'function'); | ||
assert(typeof fs.open === 'function'); | ||
assert(typeof fs.workingDirectory === 'function'); | ||
} | ||
|
||
function test_system() { | ||
assert(typeof system === 'function'); | ||
assert(typeof system.execute === 'function'); | ||
assert(typeof system.exit === 'function'); | ||
assert(typeof system.print === 'function'); | ||
} | ||
|
||
function test_Reflect() { | ||
assert(typeof Reflect === 'function'); | ||
assert(typeof Reflect.parse === 'function'); | ||
} | ||
|
||
try { | ||
test_fs(); | ||
test_system(); | ||
test_Reflect(); | ||
} catch (e) { | ||
system.print(e.message); | ||
system.print(e.stack); | ||
} | ||
|
||
system.print('No failure. Total tests: ' + total + ' tests.'); |