summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCharlie Gordon <github@chqrlie.org>2024-03-03 03:38:49 +0100
committerGitHub <noreply@github.com>2024-03-03 03:38:49 +0100
commit3dd93eb4e4b82ded4570a6baaf0a6418507144b7 (patch)
tree38201c6f2b206e503de2e38e3d5a204ca334b70c /tests
parent35b7b3c3796d41d8a6f9ad81f4293308e0d83777 (diff)
downloadquickjs-3dd93eb4e4b82ded4570a6baaf0a6418507144b7.tar.gz
quickjs-3dd93eb4e4b82ded4570a6baaf0a6418507144b7.zip
fix microbench when microbench.txt is missing (#246)
Diffstat (limited to 'tests')
-rw-r--r--tests/microbench.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/microbench.js b/tests/microbench.js
index b70e3fb..c25e4d1 100644
--- a/tests/microbench.js
+++ b/tests/microbench.js
@@ -1134,11 +1134,12 @@ function load_result(filename)
if (typeof std !== "undefined") {
// read the file in QuickJS
var f = std.open(filename, "r");
- if (!f) {
+ if (f) {
+ str = f.readAsString();
+ f.close();
+ } else {
has_error = true;
}
- str = f.readAsString();
- f.close();
} else {
return null;
}