remove typeof'
This commit is contained in:
12
test.ce
12
test.ce
@@ -287,11 +287,11 @@ function run_tests(package_name, specific_test) {
|
||||
test_mod = shop.use(mod_path, use_pkg)
|
||||
|
||||
var tests = []
|
||||
if (typeof test_mod == 'function') {
|
||||
if (is_function(test_mod)) {
|
||||
tests.push({name: 'main', fn: test_mod})
|
||||
} else if (typeof test_mod == 'object') {
|
||||
} else if (is_object(test_mod)) {
|
||||
for (var k in test_mod) {
|
||||
if (typeof test_mod[k] == 'function') {
|
||||
if (is_function(test_mod[k])) {
|
||||
tests.push({name: k, fn: test_mod[k]})
|
||||
}
|
||||
}
|
||||
@@ -312,9 +312,9 @@ function run_tests(package_name, specific_test) {
|
||||
try {
|
||||
var ret = t.fn()
|
||||
|
||||
if (typeof ret == 'string') {
|
||||
if (is_text(ret)) {
|
||||
throw new Error(ret)
|
||||
} else if (ret && (typeof ret.message == 'string' || ret instanceof Error)) {
|
||||
} else if (ret && (is_text(ret.message) || ret instanceof Error)) {
|
||||
throw ret
|
||||
}
|
||||
|
||||
@@ -330,7 +330,7 @@ function run_tests(package_name, specific_test) {
|
||||
}
|
||||
if (e.name) test_entry.error.name = e.name
|
||||
|
||||
if (typeof e == 'object' && e.message) {
|
||||
if (is_object(e) && e.message) {
|
||||
test_entry.error.message = e.message
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user