automatic-semicolon-insertion.js 692 B

1234567891011121314151617181920212223242526272829303132
  1. load("test-common.js");
  2. /**
  3. * This file tests automatic semicolon insertion rules.
  4. * If this file produces syntax errors, something is wrong.
  5. */
  6. function foo() {
  7. for (var i = 0; i < 4; i++) {
  8. break // semicolon inserted here
  9. continue // semicolon inserted here
  10. }
  11. var j // semicolon inserted here
  12. do {
  13. } while (1 === 2) // semicolon inserted here
  14. return // semicolon inserted here
  15. 1;
  16. var curly/* semicolon inserted here */}
  17. try {
  18. assert(foo() === undefined);
  19. console.log("PASS");
  20. } catch (e) {
  21. console.log("FAIL: " + e);
  22. }
  23. // This vardecl must appear exactly at the end of the file (no newline or whitespace after it)
  24. var eof