Skip to content
Browse files

added tests

existence of hasOwnProperty

global variable deletion
  • Loading branch information...
1 parent 8372c5d commit a670175d32b48cbe5899054852497fbc1b4f0afc @clog committed Dec 25, 2012
Showing with 42 additions and 0 deletions.
  1. +1 −0 tests/index.html
  2. +41 −0 tests/index.js
View
1 tests/index.html
@@ -9,5 +9,6 @@
<div id="qunit"></div>
<div id="qunit-fixture"></div>
<script src="../libraries/qunit/qunit/qunit.js"></script>
+ <script src="../tests/index.js"></script>
</body>
</html>
View
41 tests/index.js
@@ -0,0 +1,41 @@
+(function(global)
+{
+ test("Existence of hasOwnProperty", function()
+ {
+ var actual
+
+ actual = global.hasOwnProperty === {}.hasOwnProperty
+ // ie7 ie8 failed
+ equal(actual, true, "Global object has hasOwnProperty.")
+ })
+
+ test("Global variable deletion", function()
+ {
+ var actual
+
+ global.variable = 0
+ try
+ {
+ delete global.variable
+ actual = true
+ }
+ catch (e)
+ {
+ actual = false
+ }
+ // ie7 ie8 failed
+ equal(actual, true, "No error throw on deletion.")
+
+ global.variable = 0
+ try
+ {
+ delete global.variable
+ }
+ catch (e)
+ {
+ }
+ // ie7 ie8 failed
+ actual = {}.hasOwnProperty.call(global, "variable")
+ equal(actual, false, "Global variable is deleted.")
+ })
+})(this);

0 comments on commit a670175

Please sign in to comment.
Something went wrong with that request. Please try again.