[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [flashproxy/js] Better handling of null in JS tests.



commit 341de85c4475b47bc7d53c4896d9b325792f641a
Author: David Fifield <david@xxxxxxxxxxxxxxx>
Date:   Mon Mar 12 22:28:43 2012 -0700

    Better handling of null in JS tests.
    
    I read somewhere that (typeof null) is null, but that seems not to be
    the case (I get "object").
---
 flashproxy-test.js |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/flashproxy-test.js b/flashproxy-test.js
index e4a59b9..ca68f85 100755
--- a/flashproxy-test.js
+++ b/flashproxy-test.js
@@ -10,6 +10,8 @@ load("flashproxy.js");
 
 function objects_equal(a, b)
 {
+    if ((a === null) != (b === null))
+        return false;
     if (typeof a != typeof b)
         return false;
     if (typeof a != "object")
@@ -42,7 +44,7 @@ function maybe_quote(s)
 
 function repr(x)
 {
-    if (typeof x === null) {
+    if (x === null) {
         return "null";
     } else if (typeof x == "undefined") {
         return "undefined";



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits