2014-11-10 13:40:07 -05:00
|
|
|
import {describe, it, expect, IS_DARTIUM} from 'test_lib/test_lib';
|
2014-09-28 16:55:01 -04:00
|
|
|
|
2014-09-25 17:30:10 -04:00
|
|
|
import {Foo, Bar} from './foo';
|
2014-09-28 16:55:01 -04:00
|
|
|
// TODO: Does not work, as dart does not support renaming imports
|
2014-09-25 17:30:10 -04:00
|
|
|
// import {Foo as F} from './fixtures/foo';
|
2014-09-28 16:55:01 -04:00
|
|
|
import * as fooModule from './foo';
|
2014-09-25 17:30:10 -04:00
|
|
|
|
2014-09-28 16:55:01 -04:00
|
|
|
import * as exportModule from './export';
|
2014-09-25 17:30:10 -04:00
|
|
|
|
2014-09-28 16:55:01 -04:00
|
|
|
import {Type} from 'facade/lang';
|
2014-09-25 17:30:10 -04:00
|
|
|
|
2014-11-10 20:18:30 -05:00
|
|
|
import {Baz} from './reexport';
|
|
|
|
|
2014-09-28 16:55:01 -04:00
|
|
|
export function main() {
|
|
|
|
describe('imports', function() {
|
2014-11-10 20:18:30 -05:00
|
|
|
it('should re-export imported vars', function() {
|
|
|
|
expect(Baz).toBe('BAZ');
|
|
|
|
});
|
|
|
|
|
2014-09-28 16:55:01 -04:00
|
|
|
it('should work', function() {
|
|
|
|
expect(Foo).toBe('FOO');
|
|
|
|
expect(Bar).toBe('BAR');
|
|
|
|
// TODO: Does not work
|
|
|
|
// assert(F == 'FOO');
|
|
|
|
expect(fooModule.Foo).toBe('FOO');
|
|
|
|
expect(fooModule.Bar).toBe('BAR');
|
2014-09-25 17:30:10 -04:00
|
|
|
|
2014-09-28 16:55:01 -04:00
|
|
|
expect(exportModule.Foo).toBe('FOO');
|
|
|
|
expect(exportModule.Bar).toBe('BAR');
|
2014-11-10 13:40:07 -05:00
|
|
|
expect(exportModule.Bar1).toBe('BAR1');
|
|
|
|
expect(exportModule.Bar2).toBe('BAR2');
|
|
|
|
|
|
|
|
// Make sure Bar3 is not re-exported.
|
|
|
|
expect(function() {
|
|
|
|
exportModule.Bar3();
|
|
|
|
}).toThrowError(IS_DARTIUM ?
|
|
|
|
// Dart
|
|
|
|
"No top-level method 'exportModule.Bar3' declared.":
|
|
|
|
// JavaScript
|
|
|
|
'undefined is not a function'
|
|
|
|
);
|
2014-09-25 17:30:10 -04:00
|
|
|
|
2014-09-28 16:55:01 -04:00
|
|
|
expect(Type).toBeTruthy();
|
|
|
|
});
|
|
|
|
});
|
2014-09-25 17:30:10 -04:00
|
|
|
}
|