Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Side by Side Diff: test/e2e/helloworld.ts

Issue 2225953002: Strip more unused features. (Closed) Base URL: git@github.com:dart-lang/js_facade_gen.git@master
Patch Set: Fix types Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/decorator_test.ts ('k') | test/e2e/lib.ts » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /// <reference path="./test.d.ts"/> 1 // TODO(jacobr): create an end-to-end example that uses some real d.ts files.
2 /// <reference path="./typings/es6-promise/es6-promise.d.ts"/> 2 // For example: it would be reasonable to test that d3 exports as expected.
3 import t = require('test/test');
4 import {MyClass, MySubclass, SOME_ARRAY} from './lib';
5 3
6 function callOne<T, U>(a: (t: T) => U, t: T): U { 4 function main(): number {
7 return a(t); 5 return 42;
8 } 6 }
9 7
10 /* tslint:disable: no-unused-variable */ 8 main();
11 function main(): void {
12 /* tslint:enable: no-unused-variable */
13 t.test('handles classes', function() {
14 let mc = new MyClass('hello');
15 t.expect(mc.field.toUpperCase(), t.equals('HELLO WORLD'));
16 t.expect(mc.namedParam({x: '!'}), t.equals('hello!'));
17 t.expect(mc.namedParam(), t.equals('hello?'));
18 });
19 t.test('allows subclassing and casts', function() {
20 let mc: MyClass;
21 mc = new MySubclass('hello');
22 t.expect((<MySubclass>mc).subclassField, t.equals('hello world'));
23 });
24 t.test('string templates', function() {
25 t.expect('$mc', t.equals('$mc'));
26 let a = 'hello';
27 let b = 'world';
28 t.expect(`${a} ${b}`, t.equals('hello world'));
29 });
30 t.test('regexp', function() {
31 t.expect(/o\./g.test('fo.o'), t.equals(true));
32 t.expect(/o/g.exec('fo.o').length, t.equals(1));
33 t.expect(/a(b)/g.exec('ab').length, t.equals(2));
34 });
35 t.test('const expr', function() { t.expect(SOME_ARRAY[0], t.equals(1)); });
36 t.test('generic types fn', function() { t.expect(callOne((a) => a, 1), t.equal s(1)); });
37
38 t.test('promises', function() {
39 let p: Promise<number> = new Promise<number>((resolve) => { resolve(1); });
40 p.then((n) => { t.expect(n, t.equals(1)); });
41 });
42 }
OLDNEW
« no previous file with comments | « test/decorator_test.ts ('k') | test/e2e/lib.ts » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698