|
|
@ -1,5 +1,13 @@ |
|
|
|
export const tests = [] |
|
|
|
export const tests = [] |
|
|
|
const t = (f) => tests.push(f) |
|
|
|
const t = (f) => tests.push(f) |
|
|
|
|
|
|
|
const isConst = (name) => { |
|
|
|
|
|
|
|
try { |
|
|
|
|
|
|
|
eval(`${name} = 'm'`) |
|
|
|
|
|
|
|
return false |
|
|
|
|
|
|
|
} catch (err) { |
|
|
|
|
|
|
|
return true |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// escapeStr
|
|
|
|
// escapeStr
|
|
|
|
// is declared and of type string
|
|
|
|
// is declared and of type string
|
|
|
@ -72,4 +80,8 @@ t(() => nested.obj.update === undefined) |
|
|
|
t(() => cantEdit(() => nested.arr.push('hot stuff'))) |
|
|
|
t(() => cantEdit(() => nested.arr.push('hot stuff'))) |
|
|
|
t(() => nested.arr.length === 3) |
|
|
|
t(() => nested.arr.length === 3) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// check if all variable are const
|
|
|
|
|
|
|
|
t(() => ['escapeStr', 'arr', 'obj', 'nested'] |
|
|
|
|
|
|
|
.every(isConst)) |
|
|
|
|
|
|
|
|
|
|
|
Object.freeze(tests) |
|
|
|
Object.freeze(tests) |
|
|
|