rm push/pop
This commit is contained in:
40
test.ce
40
test.ce
@@ -62,7 +62,7 @@ function parse_args() {
|
||||
} else if (_args[i] == '--diff') {
|
||||
diff_mode = true
|
||||
} else {
|
||||
push(cleaned_args, _args[i])
|
||||
cleaned_args[] = _args[i]
|
||||
}
|
||||
}
|
||||
_args = cleaned_args
|
||||
@@ -247,11 +247,11 @@ function collect_actor_tests(package_name, specific_test) {
|
||||
if (test_base != match_base) continue
|
||||
}
|
||||
|
||||
push(actor_tests, {
|
||||
actor_tests[] = {
|
||||
package: package_name || "local",
|
||||
file: f,
|
||||
path: prefix + '/' + f
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
return actor_tests
|
||||
@@ -296,16 +296,16 @@ function spawn_actor_test(test_info) {
|
||||
entry.error = { message: event.reason || "Actor disrupted" }
|
||||
log.console(` FAIL ${test_name}: ${entry.error.message}`)
|
||||
}
|
||||
push(actor_test_results, entry)
|
||||
actor_test_results[] = entry
|
||||
if (gc_after_each_test) dbg.gc()
|
||||
check_completion()
|
||||
}, actor_path)
|
||||
push(pending_actor_tests, entry)
|
||||
pending_actor_tests[] = entry
|
||||
} disruption {
|
||||
entry.status = "failed"
|
||||
entry.error = { message: "Failed to spawn actor" }
|
||||
entry.duration_ns = 0
|
||||
push(actor_test_results, entry)
|
||||
actor_test_results[] = entry
|
||||
log.console(` FAIL ${test_name}: Failed to spawn`)
|
||||
}
|
||||
_spawn()
|
||||
@@ -347,7 +347,7 @@ function run_tests(package_name, specific_test) {
|
||||
match_base = ends_with(match_name, '.cm') ? text(match_name, 0, -3) : match_name
|
||||
if (test_name != match_base) continue
|
||||
}
|
||||
push(test_files, f)
|
||||
test_files[] = f
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,14 +408,14 @@ function run_tests(package_name, specific_test) {
|
||||
var first_null_key = null
|
||||
var first_other_key = null
|
||||
if (is_function(test_mod)) {
|
||||
push(tests, {name: 'main', fn: test_mod})
|
||||
tests[] = {name: 'main', fn: test_mod}
|
||||
} else if (is_object(test_mod)) {
|
||||
all_keys = array(test_mod)
|
||||
log.console(` Found ${length(all_keys)} test entries`)
|
||||
arrfor(all_keys, function(k) {
|
||||
if (is_function(test_mod[k])) {
|
||||
fn_count = fn_count + 1
|
||||
push(tests, {name: k, fn: test_mod[k]})
|
||||
tests[] = {name: k, fn: test_mod[k]}
|
||||
} else if (is_null(test_mod[k])) {
|
||||
null_count = null_count + 1
|
||||
if (!first_null_key) first_null_key = k
|
||||
@@ -494,7 +494,7 @@ function run_tests(package_name, specific_test) {
|
||||
file_result.failed = file_result.failed + 1
|
||||
}
|
||||
|
||||
push(file_result.tests, test_entry)
|
||||
file_result.tests[] = test_entry
|
||||
pkg_result.total = pkg_result.total + 1
|
||||
if (gc_after_each_test) {
|
||||
dbg.gc()
|
||||
@@ -512,7 +512,7 @@ function run_tests(package_name, specific_test) {
|
||||
file_result.failed = file_result.failed + 1
|
||||
pkg_result.total = pkg_result.total + 1
|
||||
}
|
||||
push(pkg_result.files, file_result)
|
||||
pkg_result.files[] = file_result
|
||||
}
|
||||
return pkg_result
|
||||
}
|
||||
@@ -525,18 +525,18 @@ var i = 0
|
||||
if (all_pkgs) {
|
||||
// Run local first if we're in a valid package
|
||||
if (is_valid_package('.')) {
|
||||
push(all_results, run_tests(null, null))
|
||||
all_results[] = run_tests(null, null)
|
||||
all_actor_tests = array(all_actor_tests, collect_actor_tests(null, null))
|
||||
}
|
||||
|
||||
// Then all packages in lock
|
||||
packages = shop.list_packages()
|
||||
for (i = 0; i < length(packages); i++) {
|
||||
push(all_results, run_tests(packages[i], null))
|
||||
all_results[] = run_tests(packages[i], null)
|
||||
all_actor_tests = array(all_actor_tests, collect_actor_tests(packages[i], null))
|
||||
}
|
||||
} else {
|
||||
push(all_results, run_tests(target_pkg, target_test))
|
||||
all_results[] = run_tests(target_pkg, target_test)
|
||||
all_actor_tests = array(all_actor_tests, collect_actor_tests(target_pkg, target_test))
|
||||
}
|
||||
|
||||
@@ -561,7 +561,7 @@ function check_timeouts() {
|
||||
entry = pending_actor_tests[i]
|
||||
elapsed_ms = (now - entry.start_time) * 1000
|
||||
if (elapsed_ms > ACTOR_TEST_TIMEOUT) {
|
||||
push(timed_out, i)
|
||||
timed_out[] = i
|
||||
}
|
||||
}
|
||||
|
||||
@@ -573,7 +573,7 @@ function check_timeouts() {
|
||||
entry.status = "failed"
|
||||
entry.error = { message: "Test timed out" }
|
||||
entry.duration_ns = ACTOR_TEST_TIMEOUT * 1000000
|
||||
push(actor_test_results, entry)
|
||||
actor_test_results[] = entry
|
||||
log.console(` TIMEOUT ${entry.test}`)
|
||||
}
|
||||
|
||||
@@ -612,7 +612,7 @@ function finalize_results() {
|
||||
}
|
||||
if (!pkg_result) {
|
||||
pkg_result = { package: r.package, files: [], total: 0, passed: 0, failed: 0 }
|
||||
push(all_results, pkg_result)
|
||||
all_results[] = pkg_result
|
||||
}
|
||||
|
||||
file_result = null
|
||||
@@ -624,10 +624,10 @@ function finalize_results() {
|
||||
}
|
||||
if (!file_result) {
|
||||
file_result = { name: r.file, tests: [], passed: 0, failed: 0 }
|
||||
push(pkg_result.files, file_result)
|
||||
pkg_result.files[] = file_result
|
||||
}
|
||||
|
||||
push(file_result.tests, r)
|
||||
file_result.tests[] = r
|
||||
pkg_result.total = pkg_result.total + 1
|
||||
if (r.status == "passed") {
|
||||
pkg_result.passed = pkg_result.passed + 1
|
||||
@@ -760,7 +760,7 @@ Total: ${totals.total}, Passed: ${totals.passed}, Failed: ${totals.failed}
|
||||
for (j = 0; j < length(pkg_res.files); j++) {
|
||||
f = pkg_res.files[j]
|
||||
for (k = 0; k < length(f.tests); k++) {
|
||||
push(pkg_tests, f.tests[k])
|
||||
pkg_tests[] = f.tests[k]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user