Add tests

This commit is contained in:
Anders Hejlsberg 2016-09-29 15:11:51 -07:00
parent 1c39cdc7ef
commit d8ec85775a
2 changed files with 239 additions and 0 deletions

View File

@ -0,0 +1,119 @@
// @strictNullChecks: true
declare let cond: boolean;
function f1() {
let x;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f2() {
let x = undefined;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f3() {
let x = null;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f4() {
let x: any;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f5() {
var x;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f6() {
var x = undefined;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f7() {
var x = null;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f8() {
var x: any;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f9() {
let x;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
function f() {
const z = x;
}
}
function f10() {
let x;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
const f = () => {
const z = x;
};
}

View File

@ -0,0 +1,120 @@
// @strictNullChecks: true
// @noImplicitAny: true
declare let cond: boolean;
function f1() {
let x;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f2() {
let x = undefined;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f3() {
let x = null;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f4() {
let x: any;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f5() {
var x;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f6() {
var x = undefined;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f7() {
var x = null;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f8() {
var x: any;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
}
function f9() {
let x;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
function f() {
const z = x;
}
}
function f10() {
let x;
if (cond) {
x = 1;
}
if (cond) {
x = "hello";
}
const y = x;
const f = () => {
const z = x;
};
}