blob: c662b71bb88c454cb6015208b2c50aece91b28fb [file] [log] [blame]
description(
"This test checks whether various forms of typeof expression are allowed."
);
var x = 0;
var y = 0;
shouldBe('typeof x', "'number'");
shouldBe('typeof window.x', "'number'");
shouldBe('typeof window["x"]', "'number'");
shouldBe('typeof (x)', "'number'");
shouldBe('typeof (window.x)', "'number'");
shouldBe('typeof (window["x"])', "'number'");
shouldBe('(y, typeof x)', "'number'");
shouldBe('typeof ((x))', "'number'");
shouldBe('typeof ((window.x))', "'number'");
shouldBe('typeof ((window["x"]))', "'number'");
shouldBe('typeof (y, x)', "'number'");
shouldBe('typeof (true ? x : y)', "'number'");
shouldBe('typeof nonexistent', "'undefined'");
shouldBe('typeof window.nonexistent', "'undefined'");
shouldBe('typeof window["nonexistent"]', "'undefined'");
shouldBe('typeof (nonexistent)', "'undefined'");
shouldBe('typeof (window.nonexistent)', "'undefined'");
shouldBe('typeof (window["nonexistent"])', "'undefined'");