Adding tests

This commit is contained in:
Anders Hejlsberg committed 2016-05-03 17:05:23 -07:00
1 parent ccad31bf24
commit e828fce952
3 files changed
+289

No files matched your search

@@ -0,0 +1,84 @@
tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(60,9): error TS2365: Operator '>' cannot be applied to types 'number' and 'undefined'.
tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(62,9): error TS2365: Operator '<' cannot be applied to types 'number' and 'undefined'.
tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(64,9): error TS2365: Operator '>=' cannot be applied to types 'number' and 'undefined'.
tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts(66,9): error TS2365: Operator '<=' cannot be applied to types 'number' and 'undefined'.
==== tests/cases/conformance/types/typeRelationships/comparable/equalityStrictNulls.ts (4 errors) ====
function f1(x: string) {
if (x == undefined) {
}
if (x != undefined) {
}
if (x === undefined) {
}
if (x !== undefined) {
}
if (x == null) {
}
if (x != null) {
}
if (x === null) {
}
if (x !== null) {
}
if (undefined == x) {
}
if (undefined != x) {
}
if (undefined === x) {
}
if (undefined !== x) {
}
if (null == x) {
}
if (null != x) {
}
if (null === x) {
}
if (null !== x) {
}
}
function f2() {
if (undefined == undefined) {
}
if (undefined == null) {
}
if (null == undefined) {
}
if (null == null) {
}
}
function f3(a: number, b: boolean, c: { x: number }, d: number | string) {
if (a == null) {
}
if (b == null) {
}
if (c == null) {
}
if (d == null) {
}
}
function f4(x: number) {
if (x > undefined) {
~~~~~~~~~~~~~
!!! error TS2365: Operator '>' cannot be applied to types 'number' and 'undefined'.
}
if (x < undefined) {
~~~~~~~~~~~~~
!!! error TS2365: Operator '<' cannot be applied to types 'number' and 'undefined'.
}
if (x >= undefined) {
~~~~~~~~~~~~~~
!!! error TS2365: Operator '>=' cannot be applied to types 'number' and 'undefined'.
}
if (x <= undefined) {
~~~~~~~~~~~~~~
!!! error TS2365: Operator '<=' cannot be applied to types 'number' and 'undefined'.
}
}
@@ -0,0 +1,136 @@
//// [equalityStrictNulls.ts]
function f1(x: string) {
if (x == undefined) {
}
if (x != undefined) {
}
if (x === undefined) {
}
if (x !== undefined) {
}
if (x == null) {
}
if (x != null) {
}
if (x === null) {
}
if (x !== null) {
}
if (undefined == x) {
}
if (undefined != x) {
}
if (undefined === x) {
}
if (undefined !== x) {
}
if (null == x) {
}
if (null != x) {
}
if (null === x) {
}
if (null !== x) {
}
}
function f2() {
if (undefined == undefined) {
}
if (undefined == null) {
}
if (null == undefined) {
}
if (null == null) {
}
}
function f3(a: number, b: boolean, c: { x: number }, d: number | string) {
if (a == null) {
}
if (b == null) {
}
if (c == null) {
}
if (d == null) {
}
}
function f4(x: number) {
if (x > undefined) {
}
if (x < undefined) {
}
if (x >= undefined) {
}
if (x <= undefined) {
}
}
//// [equalityStrictNulls.js]
function f1(x) {
if (x == undefined) {
}
if (x != undefined) {
}
if (x === undefined) {
}
if (x !== undefined) {
}
if (x == null) {
}
if (x != null) {
}
if (x === null) {
}
if (x !== null) {
}
if (undefined == x) {
}
if (undefined != x) {
}
if (undefined === x) {
}
if (undefined !== x) {
}
if (null == x) {
}
if (null != x) {
}
if (null === x) {
}
if (null !== x) {
}
}
function f2() {
if (undefined == undefined) {
}
if (undefined == null) {
}
if (null == undefined) {
}
if (null == null) {
}
}
function f3(a, b, c, d) {
if (a == null) {
}
if (b == null) {
}
if (c == null) {
}
if (d == null) {
}
}
function f4(x) {
if (x > undefined) {
}
if (x < undefined) {
}
if (x >= undefined) {
}
if (x <= undefined) {
}
}
@@ -0,0 +1,69 @@
// @strictNullChecks: true
function f1(x: string) {
if (x == undefined) {
}
if (x != undefined) {
}
if (x === undefined) {
}
if (x !== undefined) {
}
if (x == null) {
}
if (x != null) {
}
if (x === null) {
}
if (x !== null) {
}
if (undefined == x) {
}
if (undefined != x) {
}
if (undefined === x) {
}
if (undefined !== x) {
}
if (null == x) {
}
if (null != x) {
}
if (null === x) {
}
if (null !== x) {
}
}
function f2() {
if (undefined == undefined) {
}
if (undefined == null) {
}
if (null == undefined) {
}
if (null == null) {
}
}
function f3(a: number, b: boolean, c: { x: number }, d: number | string) {
if (a == null) {
}
if (b == null) {
}
if (c == null) {
}
if (d == null) {
}
}
function f4(x: number) {
if (x > undefined) {
}
if (x < undefined) {
}
if (x >= undefined) {
}
if (x <= undefined) {
}
}