Files
sausage/userland/qjs/source/tests/null_or_undefined.js
T
surma d44f1d9677 Build separate native and WASI pipelines with shared multicall names
Checkpoint before integration and package validation.

Assisted-by: SurmAgent:unknown [read] [edit] [bash]
2026-11-12 09:36:27 +00:00

39 lines
656 B
JavaScript

import {assert} from "./assert.js"
let ex
try {
null.x
} catch (e) {
ex = e
}
assert(ex instanceof TypeError)
assert(ex.message, "cannot read property 'x' of null")
ex = undefined
try {
null["x"]
} catch (e) {
ex = e
}
assert(ex instanceof TypeError)
assert(ex.message, "cannot read property 'x' of null")
ex = undefined
try {
undefined.x
} catch (e) {
ex = e
}
assert(ex instanceof TypeError)
assert(ex.message, "cannot read property 'x' of undefined")
ex = undefined
try {
undefined["x"]
} catch (e) {
ex = e
}
assert(ex instanceof TypeError)
assert(ex.message, "cannot read property 'x' of undefined")
ex = undefined