packages/babel-plugin-transform-block-scoping/test/fixtures/const-violations/no-for-in/exec.js
raw symbols SCIP| 1 | const state = {}; |
| 2 | function f(arr) { |
| 3 | const MULTIPLIER = 5; |
| 4 | state.getMultiplier = () => MULTIPLIER; |
| 5 | |
| 6 | for (MULTIPLIER in arr); |
| 7 | |
| 8 | return 'survived'; |
| 9 | } |
| 10 | |
| 11 | expect(function() { |
| 12 | f([1,2,3]); |
| 13 | }).toThrow('"MULTIPLIER" is read-only'); |
| 14 | expect(state.getMultiplier()).toBe(5); // Assignment did not succeed |
| 15 | |
| 16 | expect(f([])).toBe('survived'); |