michael@0: function testSwitchString() { michael@0: var x = "asdf"; michael@0: var ret = 0; michael@0: for (var i = 0; i < 100; ++i) { michael@0: switch (x) { michael@0: case "asdf": michael@0: x = "asd"; michael@0: ret += 1; michael@0: break; michael@0: case "asd": michael@0: x = "as"; michael@0: ret += 2; michael@0: break; michael@0: case "as": michael@0: x = "a"; michael@0: ret += 3; michael@0: break; michael@0: case "a": michael@0: x = "foo"; michael@0: ret += 4; michael@0: break; michael@0: default: michael@0: x = "asdf"; michael@0: } michael@0: } michael@0: return ret; michael@0: } michael@0: assertEq(testSwitchString(), 200);