Skip to content

Commit 24e7e1c

Browse files
author
Forbes Lindesay
committed
Add missing test case output
1 parent d3c572c commit 24e7e1c

File tree

3 files changed

+109
-0
lines changed

3 files changed

+109
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//// [typeGuardBoolean.ts]
2+
function test(strOrNull: string | null, strOrUndefined: string | undefined) {
3+
var str: string = "original";
4+
var nil: null;
5+
if (!Boolean(strOrNull)) {
6+
nil = strOrNull;
7+
}
8+
else {
9+
str = strOrNull;
10+
}
11+
if (Boolean(strOrUndefined)) {
12+
str = strOrUndefined;
13+
}
14+
}
15+
16+
17+
//// [typeGuardBoolean.js]
18+
function test(strOrNull, strOrUndefined) {
19+
var str = "original";
20+
var nil;
21+
if (!Boolean(strOrNull)) {
22+
nil = strOrNull;
23+
}
24+
else {
25+
str = strOrNull;
26+
}
27+
if (Boolean(strOrUndefined)) {
28+
str = strOrUndefined;
29+
}
30+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
=== tests/cases/conformance/expressions/typeGuards/typeGuardBoolean.ts ===
2+
function test(strOrNull: string | null, strOrUndefined: string | undefined) {
3+
>test : Symbol(test, Decl(typeGuardBoolean.ts, 0, 0))
4+
>strOrNull : Symbol(strOrNull, Decl(typeGuardBoolean.ts, 0, 14))
5+
>strOrUndefined : Symbol(strOrUndefined, Decl(typeGuardBoolean.ts, 0, 39))
6+
7+
var str: string = "original";
8+
>str : Symbol(str, Decl(typeGuardBoolean.ts, 1, 5))
9+
10+
var nil: null;
11+
>nil : Symbol(nil, Decl(typeGuardBoolean.ts, 2, 5))
12+
13+
if (!Boolean(strOrNull)) {
14+
>Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
15+
>strOrNull : Symbol(strOrNull, Decl(typeGuardBoolean.ts, 0, 14))
16+
17+
nil = strOrNull;
18+
>nil : Symbol(nil, Decl(typeGuardBoolean.ts, 2, 5))
19+
>strOrNull : Symbol(strOrNull, Decl(typeGuardBoolean.ts, 0, 14))
20+
}
21+
else {
22+
str = strOrNull;
23+
>str : Symbol(str, Decl(typeGuardBoolean.ts, 1, 5))
24+
>strOrNull : Symbol(strOrNull, Decl(typeGuardBoolean.ts, 0, 14))
25+
}
26+
if (Boolean(strOrUndefined)) {
27+
>Boolean : Symbol(Boolean, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
28+
>strOrUndefined : Symbol(strOrUndefined, Decl(typeGuardBoolean.ts, 0, 39))
29+
30+
str = strOrUndefined;
31+
>str : Symbol(str, Decl(typeGuardBoolean.ts, 1, 5))
32+
>strOrUndefined : Symbol(strOrUndefined, Decl(typeGuardBoolean.ts, 0, 39))
33+
}
34+
}
35+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
=== tests/cases/conformance/expressions/typeGuards/typeGuardBoolean.ts ===
2+
function test(strOrNull: string | null, strOrUndefined: string | undefined) {
3+
>test : (strOrNull: string | null, strOrUndefined: string | undefined) => void
4+
>strOrNull : string | null
5+
>null : null
6+
>strOrUndefined : string | undefined
7+
8+
var str: string = "original";
9+
>str : string
10+
>"original" : "original"
11+
12+
var nil: null;
13+
>nil : null
14+
>null : null
15+
16+
if (!Boolean(strOrNull)) {
17+
>!Boolean(strOrNull) : boolean
18+
>Boolean(strOrNull) : boolean
19+
>Boolean : BooleanConstructor
20+
>strOrNull : string | null
21+
22+
nil = strOrNull;
23+
>nil = strOrNull : null
24+
>nil : null
25+
>strOrNull : null
26+
}
27+
else {
28+
str = strOrNull;
29+
>str = strOrNull : string
30+
>str : string
31+
>strOrNull : string
32+
}
33+
if (Boolean(strOrUndefined)) {
34+
>Boolean(strOrUndefined) : boolean
35+
>Boolean : BooleanConstructor
36+
>strOrUndefined : string | undefined
37+
38+
str = strOrUndefined;
39+
>str = strOrUndefined : string
40+
>str : string
41+
>strOrUndefined : string
42+
}
43+
}
44+

0 commit comments

Comments
 (0)