builtin_function_test.go 433 B

123456789101112131415161718192021
  1. package goja
  2. import (
  3. "testing"
  4. )
  5. func TestHashbangInFunctionConstructor(t *testing.T) {
  6. const SCRIPT = `
  7. assert.throws(SyntaxError, function() {
  8. new Function("#!")
  9. });
  10. `
  11. testScriptWithTestLib(SCRIPT, _undefined, t)
  12. }
  13. func TestFunctionApplyNullArgArray(t *testing.T) {
  14. const SCRIPT = `
  15. assert.sameValue(0, (function() {return arguments.length}).apply(undefined, null))
  16. `
  17. testScriptWithTestLib(SCRIPT, _undefined, t)
  18. }