quickjs-done/tests/function_source.js

15 lines
285 B
JavaScript
Raw Permalink Normal View History

2025-01-06 20:48:15 +00:00
"use strict"
const expect = "function f() { return 42 }"
function f() { return 42 }
{
const actual = f.toString()
if (actual !== expect) throw Error(actual)
}
{
const f = eval(expect + "f")
const actual = f.toString()
if (actual !== expect) throw Error(actual)
}