js: add basic support for running tests, fix string.replace_each (#11314)

This commit is contained in:
playX 2021-08-26 15:20:54 +03:00 committed by GitHub
parent 403da9f36e
commit bdf11d969a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 178 additions and 28 deletions

View file

@ -36,3 +36,11 @@ pub fn eprint(s any) {
panic('Cannot `eprint` in a browser, use `println` instead')
}
}
// Exits the process in node, and halts execution in the browser
// because `process.exit` is undefined. Workaround for not having
// a 'real' way to exit in the browser.
pub fn exit(c int) {
JS.process.exit(c)
js_throw('exit($c)')
}