Add tests for noLib with <reference lib>.

This commit is contained in:
Martin Probst 2018-12-15 16:43:37 +01:00
parent 11b150129a
commit cc7ddaed28
4 changed files with 136 additions and 0 deletions

View File

@ -0,0 +1,51 @@
//// [tests/cases/conformance/declarationEmit/libReferenceNoLib.ts] ////
//// [fakelib.ts]
// Test that passing noLib disables <reference lib> resolution.
interface Object { }
interface Array<T> { }
interface String { }
interface Boolean { }
interface Number { }
interface Function { }
interface RegExp { }
interface IArguments { }
//// [file1.ts]
/// <reference lib="dom" />
export declare interface HTMLElement { field: string; }
export const elem: HTMLElement = { field: 'a' };
//// [fakelib.js]
// Test that passing noLib disables <reference lib> resolution.
//// [file1.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.elem = { field: 'a' };
//// [fakelib.d.ts]
interface Object {
}
interface Array<T> {
}
interface String {
}
interface Boolean {
}
interface Number {
}
interface Function {
}
interface RegExp {
}
interface IArguments {
}
//// [file1.d.ts]
export declare interface HTMLElement {
field: string;
}
export declare const elem: HTMLElement;

View File

@ -0,0 +1,40 @@
=== tests/cases/conformance/declarationEmit/fakelib.ts ===
// Test that passing noLib disables <reference lib> resolution.
interface Object { }
>Object : Symbol(Object, Decl(fakelib.ts, 0, 0))
interface Array<T> { }
>Array : Symbol(Array, Decl(fakelib.ts, 2, 20))
>T : Symbol(T, Decl(fakelib.ts, 3, 16))
interface String { }
>String : Symbol(String, Decl(fakelib.ts, 3, 22))
interface Boolean { }
>Boolean : Symbol(Boolean, Decl(fakelib.ts, 4, 20))
interface Number { }
>Number : Symbol(Number, Decl(fakelib.ts, 5, 21))
interface Function { }
>Function : Symbol(Function, Decl(fakelib.ts, 6, 20))
interface RegExp { }
>RegExp : Symbol(RegExp, Decl(fakelib.ts, 7, 22))
interface IArguments { }
>IArguments : Symbol(IArguments, Decl(fakelib.ts, 8, 20))
=== tests/cases/conformance/declarationEmit/file1.ts ===
/// <reference lib="dom" />
export declare interface HTMLElement { field: string; }
>HTMLElement : Symbol(HTMLElement, Decl(file1.ts, 0, 0))
>field : Symbol(HTMLElement.field, Decl(file1.ts, 1, 38))
export const elem: HTMLElement = { field: 'a' };
>elem : Symbol(elem, Decl(file1.ts, 2, 12))
>HTMLElement : Symbol(HTMLElement, Decl(file1.ts, 0, 0))
>field : Symbol(field, Decl(file1.ts, 2, 34))

View File

@ -0,0 +1,24 @@
=== tests/cases/conformance/declarationEmit/fakelib.ts ===
// Test that passing noLib disables <reference lib> resolution.
No type information for this code.
No type information for this code.interface Object { }
No type information for this code.interface Array<T> { }
No type information for this code.interface String { }
No type information for this code.interface Boolean { }
No type information for this code.interface Number { }
No type information for this code.interface Function { }
No type information for this code.interface RegExp { }
No type information for this code.interface IArguments { }
No type information for this code.
No type information for this code.
No type information for this code.=== tests/cases/conformance/declarationEmit/file1.ts ===
/// <reference lib="dom" />
export declare interface HTMLElement { field: string; }
>field : string
export const elem: HTMLElement = { field: 'a' };
>elem : HTMLElement
>{ field: 'a' } : { field: string; }
>field : string
>'a' : "a"

View File

@ -0,0 +1,21 @@
// @target: esnext
// @module: commonjs
// @noLib: true
// @declaration: true
// Test that passing noLib disables <reference lib> resolution.
// @filename: fakelib.ts
interface Object { }
interface Array<T> { }
interface String { }
interface Boolean { }
interface Number { }
interface Function { }
interface RegExp { }
interface IArguments { }
// @filename: file1.ts
/// <reference lib="dom" />
export declare interface HTMLElement { field: string; }
export const elem: HTMLElement = { field: 'a' };