| Index: test/module_test.ts
|
| diff --git a/test/module_test.ts b/test/module_test.ts
|
| index 12987f7bda4e61dcf886947b439fa05eece6a0eb..e7a372fba54a28796c591ddcbafddeff8cd43ab2 100644
|
| --- a/test/module_test.ts
|
| +++ b/test/module_test.ts
|
| @@ -16,10 +16,10 @@ describe('imports', () => {
|
| it('translates import star', () => {
|
| expectTranslate('import * as foo from "z";').to.equal('import "package:z.dart" as foo;');
|
| });
|
| - it('allows import dart file from relative path', () => {
|
| + it('simplify import dart file imports with relative paths', () => {
|
| expectTranslate('import x = require("./y")').to.equal('import "y.dart" as x;');
|
| expectTranslate('import {x} from "./y"').to.equal('import "y.dart" show x;');
|
| - expectTranslate('import {x} from "../y"').to.equal('import "../y.dart" show x;');
|
| + expectTranslate('import {x} from "../y"').to.equal('import "y.dart" show x;');
|
| });
|
| it('fails for renamed imports', () => {
|
| expectErroneousCode('import {Foo as Bar} from "baz";')
|
| @@ -51,6 +51,14 @@ class X {
|
| it('allows named export declarations', () => {
|
| expectTranslate('export {a, b} from "X";').to.equal('export "package:X.dart" show a, b;');
|
| });
|
| + it('ignores named export declarations', () => {
|
| + expectTranslate(`declare module '../some_other_module' {
|
| + interface Foo { }
|
| + }`)
|
| + .to.equal(
|
| + '// Library augmentation not allowed by Dart. Ignoring augmentation of ../some_other_module');
|
| + });
|
| +
|
| it('fails for renamed exports', () => {
|
| expectErroneousCode('export {Foo as Bar} from "baz";')
|
| .to.throw(/import\/export renames are unsupported in Dart/);
|
| @@ -62,18 +70,18 @@ class X {
|
| () => { expectErroneousCode('export {} from "baz";').to.throw(/empty export list/); });
|
| });
|
|
|
| -describe('library name', () => {
|
| +describe('module name', () => {
|
| let transpiler: main.Transpiler;
|
| let modTranspiler: ModuleTranspiler;
|
| beforeEach(() => {
|
| - transpiler = new main.Transpiler({failFast: true, generateLibraryName: true, basePath: '/a'});
|
| + transpiler = new main.Transpiler({failFast: true, moduleName: 'sample_module', basePath: '/a'});
|
| modTranspiler = new ModuleTranspiler(
|
| - transpiler, new FacadeConverter(transpiler, '', new NameRewriter(), false), true);
|
| + transpiler, new FacadeConverter(transpiler, '', new NameRewriter()), 'sample_module');
|
| });
|
| - it('adds a library name', () => {
|
| + it('adds module name', () => {
|
| let results = translateSources(
|
| - {'/a/b/c.ts': 'var x;'}, {failFast: true, generateLibraryName: true, basePath: '/a'});
|
| - chai.expect(results['/a/b/c.ts']).to.equal(`@JS()
|
| + {'/a/b/c.ts': 'var x;'}, {failFast: true, moduleName: 'sample_module', basePath: '/a'});
|
| + chai.expect(results['/a/b/c.ts']).to.equal(`@JS("sample_module")
|
| library b.c;
|
|
|
| import "package:js/js.dart";
|
|
|