Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | function get(x) { |
michael@0 | 2 | return x; |
michael@0 | 3 | } |
michael@0 | 4 | |
michael@0 | 5 | function f(x) { |
michael@0 | 6 | switch(x) { |
michael@0 | 7 | case get(0): |
michael@0 | 8 | return 0; |
michael@0 | 9 | case get(1): |
michael@0 | 10 | return 1; |
michael@0 | 11 | case get("foo"): |
michael@0 | 12 | return "foo"; |
michael@0 | 13 | case get(true): |
michael@0 | 14 | return true; |
michael@0 | 15 | case get(false): |
michael@0 | 16 | return false; |
michael@0 | 17 | case get({}): |
michael@0 | 18 | return {}; |
michael@0 | 19 | case get(null): |
michael@0 | 20 | return null; |
michael@0 | 21 | case Number.MIN_VALUE: |
michael@0 | 22 | return Number.MIN_VALUE; |
michael@0 | 23 | case Math: |
michael@0 | 24 | return Math; |
michael@0 | 25 | default: |
michael@0 | 26 | return -123; |
michael@0 | 27 | } |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | assertEq(f(0), 0); |
michael@0 | 31 | assertEq(f(-0), 0); |
michael@0 | 32 | assertEq(f(1), 1); |
michael@0 | 33 | assertEq(f("foo"), "foo"); |
michael@0 | 34 | assertEq(f(true), true); |
michael@0 | 35 | assertEq(f(false), false); |
michael@0 | 36 | assertEq(f({}), -123); |
michael@0 | 37 | assertEq(f([]), -123); |
michael@0 | 38 | assertEq(f(Math), Math); |
michael@0 | 39 | |
michael@0 | 40 | assertEq(f({x:1}), -123); |
michael@0 | 41 | assertEq(f(333), -123); |
michael@0 | 42 | assertEq(f(null), null); |
michael@0 | 43 | assertEq(f(undefined), -123); |
michael@0 | 44 | |
michael@0 | 45 | assertEq(f(Number.MIN_VALUE), Number.MIN_VALUE); |
michael@0 | 46 |