Skip to content

Commit

Permalink
Consolidate test cases for discussion
Browse files Browse the repository at this point in the history
  • Loading branch information
Joel Jeske committed May 21, 2020
1 parent 8362b3a commit 2d120e5
Show file tree
Hide file tree
Showing 17 changed files with 75 additions and 92 deletions.
4 changes: 2 additions & 2 deletions src/utils/systemJsRendering.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ export function getSystemExportStatement(exportedVariables: Variable[]): string
return `exports('${exportedVariables[0].safeExportName ||
exportedVariables[0].exportName[0]}', ${exportedVariables[0].getName()})`;
} else {
return `exports({ ${exportedVariables
return `exports({${exportedVariables
.map(variable =>
// TODO: do we always have export names at this point?
variable.exportName!.map(exportName => `${exportName}: ${variable.getName()}`)
.join(', ')
)
.join(', ')} })`;
.join(', ')}})`;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 9 additions & 0 deletions test/form/samples/system-multiple-export-bindings/_config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
description: 'supports multiple live bindings for the same symbol in systemJS',
options: {
output: {
format: 'system',
exports: 'named'
}
}
};
37 changes: 37 additions & 0 deletions test/form/samples/system-multiple-export-bindings/_expected.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
System.register([], function (exports) {
'use strict';
return {
execute: function () {

const x = exports('x', 123);
const y = exports('y', 456);

var namespace = /*#__PURE__*/Object.freeze({
__proto__: null,
x: x,
y: y
});
exports({namespace: namespace, namespace2: namespace});

// Namespace variable

// Variable Declaration
let a = exports('default', exports('a2', exports('a', 1))), b = exports('b', 2), c = exports('c2', exports('c' = 3));

// Export default expression

// Assignment Expression
a = exports('default', exports('a2', exports('a', b = exports('b', c = exports('c2', exports('c', 0))))));

// Destructing Assignment Expression
(function (v) {exports({a: a, a2: a, default: a, b: b, c: c, c2: c}); return v;} ({a, b, c} = { c: 4, b: 5, a: 6 }));

// Update Expression
a = exports('default', exports('a2', exports('a', a + 1))), b = exports('b', b + 1), c = exports('c2', exports('c', c + 1));

// Class Declaration
export class A {} exports({ A: A, B: A });

}
};
});
25 changes: 25 additions & 0 deletions test/form/samples/system-multiple-export-bindings/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Namespace variable
import * as namespace from './namespace';
export { namespace, namespace as namespace2 }
export * from './namespace';

// Variable Declaration
export let a = 1, b = 2, c = 3;
export { a as a2, c as c2 }

// Export default expression
export default a;

// Assignment Expression
a = b = c = 0;

// Destructing Assignment Expression
({ a, b, c } = { c: 4, b: 5, a: 6 });

// Update Expression
a++, b++, ++c;

// Class Declaration
export class A {}
export { A as B }

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const x = 123;
export const y = 456;

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 2d120e5

Please sign in to comment.