Add tests and baselines

This commit is contained in:
Kanchalai Tanglertsampan 2017-02-17 13:13:26 -08:00
parent 096c15b0de
commit fc6eee1a6c
11 changed files with 253 additions and 0 deletions

View file

@ -0,0 +1,24 @@
//// [file.tsx]
import React = require('react');
const Foo = (props: any) => null;
function Greet(x: {name?: string}) {
return null;
}
const foo = <Foo />;
const G = <Greet />;
//// [file.jsx]
define(["require", "exports", "react"], function (require, exports, React) {
"use strict";
exports.__esModule = true;
var Foo = function (props) { return null; };
function Greet(x) {
return null;
}
var foo = <Foo />;
var G = <Greet />;
});

View file

@ -0,0 +1,25 @@
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : Symbol(React, Decl(file.tsx, 0, 0))
const Foo = (props: any) => null;
>Foo : Symbol(Foo, Decl(file.tsx, 3, 5))
>props : Symbol(props, Decl(file.tsx, 3, 13))
function Greet(x: {name?: string}) {
>Greet : Symbol(Greet, Decl(file.tsx, 3, 33))
>x : Symbol(x, Decl(file.tsx, 5, 15))
>name : Symbol(name, Decl(file.tsx, 5, 19))
return null;
}
const foo = <Foo />;
>foo : Symbol(foo, Decl(file.tsx, 9, 5))
>Foo : Symbol(Foo, Decl(file.tsx, 3, 5))
const G = <Greet />;
>G : Symbol(G, Decl(file.tsx, 10, 5))
>Greet : Symbol(Greet, Decl(file.tsx, 3, 33))

View file

@ -0,0 +1,30 @@
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : typeof React
const Foo = (props: any) => null;
>Foo : (props: any) => any
>(props: any) => null : (props: any) => any
>props : any
>null : null
function Greet(x: {name?: string}) {
>Greet : (x: { name?: string; }) => any
>x : { name?: string; }
>name : string
return null;
>null : null
}
const foo = <Foo />;
>foo : JSX.Element
><Foo /> : JSX.Element
>Foo : (props: any) => any
const G = <Greet />;
>G : JSX.Element
><Greet /> : JSX.Element
>Greet : (x: { name?: string; }) => any

View file

@ -0,0 +1,24 @@
//// [file.tsx]
import React = require('react');
const Foo = (props: any) => null;
function Greet(x: {name?: string}) {
return null;
}
const foo = <Foo />;
const G = <Greet />;
//// [file.jsx]
define(["require", "exports", "react"], function (require, exports, React) {
"use strict";
exports.__esModule = true;
var Foo = function (props) { return null; };
function Greet(x) {
return null;
}
var foo = <Foo />;
var G = <Greet />;
});

View file

@ -0,0 +1,25 @@
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : Symbol(React, Decl(file.tsx, 0, 0))
const Foo = (props: any) => null;
>Foo : Symbol(Foo, Decl(file.tsx, 3, 5))
>props : Symbol(props, Decl(file.tsx, 3, 13))
function Greet(x: {name?: string}) {
>Greet : Symbol(Greet, Decl(file.tsx, 3, 33))
>x : Symbol(x, Decl(file.tsx, 5, 15))
>name : Symbol(name, Decl(file.tsx, 5, 19))
return null;
}
const foo = <Foo />;
>foo : Symbol(foo, Decl(file.tsx, 9, 5))
>Foo : Symbol(Foo, Decl(file.tsx, 3, 5))
const G = <Greet />;
>G : Symbol(G, Decl(file.tsx, 10, 5))
>Greet : Symbol(Greet, Decl(file.tsx, 3, 33))

View file

@ -0,0 +1,30 @@
=== tests/cases/conformance/jsx/file.tsx ===
import React = require('react');
>React : typeof React
const Foo = (props: any) => null;
>Foo : (props: any) => null
>(props: any) => null : (props: any) => null
>props : any
>null : null
function Greet(x: {name?: string}) {
>Greet : (x: { name?: string | undefined; }) => null
>x : { name?: string | undefined; }
>name : string | undefined
return null;
>null : null
}
const foo = <Foo />;
>foo : JSX.Element
><Foo /> : JSX.Element
>Foo : (props: any) => null
const G = <Greet />;
>G : JSX.Element
><Greet /> : JSX.Element
>Greet : (x: { name?: string | undefined; }) => null

View file

@ -0,0 +1,20 @@
tests/cases/conformance/jsx/file.tsx(10,13): error TS2605: JSX element type 'undefined' is not a constructor function for JSX elements.
tests/cases/conformance/jsx/file.tsx(11,11): error TS2605: JSX element type 'undefined' is not a constructor function for JSX elements.
==== tests/cases/conformance/jsx/file.tsx (2 errors) ====
import React = require('react');
const Foo = (props: any) => undefined;
function Greet(x: {name?: string}) {
return undefined;
}
// Error
const foo = <Foo />;
~~~~~~~
!!! error TS2605: JSX element type 'undefined' is not a constructor function for JSX elements.
const G = <Greet />;
~~~~~~~~~
!!! error TS2605: JSX element type 'undefined' is not a constructor function for JSX elements.

View file

@ -0,0 +1,25 @@
//// [file.tsx]
import React = require('react');
const Foo = (props: any) => undefined;
function Greet(x: {name?: string}) {
return undefined;
}
// Error
const foo = <Foo />;
const G = <Greet />;
//// [file.jsx]
define(["require", "exports", "react"], function (require, exports, React) {
"use strict";
exports.__esModule = true;
var Foo = function (props) { return undefined; };
function Greet(x) {
return undefined;
}
// Error
var foo = <Foo />;
var G = <Greet />;
});

View file

@ -0,0 +1,16 @@
// @filename: file.tsx
// @jsx: preserve
// @module: amd
// @noLib: true
// @libFiles: react.d.ts,lib.d.ts
import React = require('react');
const Foo = (props: any) => null;
function Greet(x: {name?: string}) {
return null;
}
const foo = <Foo />;
const G = <Greet />;

View file

@ -0,0 +1,17 @@
// @filename: file.tsx
// @jsx: preserve
// @module: amd
// @noLib: true
// @strictNullChecks: true
// @libFiles: react.d.ts,lib.d.ts
import React = require('react');
const Foo = (props: any) => null;
function Greet(x: {name?: string}) {
return null;
}
const foo = <Foo />;
const G = <Greet />;

View file

@ -0,0 +1,17 @@
// @filename: file.tsx
// @jsx: preserve
// @module: amd
// @noLib: true
// @strictNullChecks: true
// @libFiles: react.d.ts,lib.d.ts
import React = require('react');
const Foo = (props: any) => undefined;
function Greet(x: {name?: string}) {
return undefined;
}
// Error
const foo = <Foo />;
const G = <Greet />;