Better fix for equality of typeof ... against "undefined"

This commit is contained in:
Mihai Bazon
2013-05-08 16:22:39 +03:00
parent a1958aad56
commit a6ed2c84ac
2 changed files with 26 additions and 14 deletions

View File

@@ -3,7 +3,7 @@ typeof_eq_undefined: {
comparisons: true
};
input: { a = typeof b.c != "undefined" }
expect: { a = typeof b.c != "undefined" }
expect: { a = "undefined" != typeof b.c }
}
typeof_eq_undefined_unsafe: {
@@ -12,5 +12,14 @@ typeof_eq_undefined_unsafe: {
unsafe: true
};
input: { a = typeof b.c != "undefined" }
expect: { a = b.c !== void 0 }
expect: { a = void 0 !== b.c }
}
typeof_eq_undefined_unsafe2: {
options = {
comparisons: true,
unsafe: true
};
input: { a = "undefined" != typeof b.c }
expect: { a = void 0 !== b.c }
}