Browse Source

Test for plural resolveId functions.

better-aggressive
Oskar Segersvärd 10 years ago
parent
commit
162fba9c28
  1. 23
      test/function/custom-path-resolver-plural/_config.js
  2. 2
      test/function/custom-path-resolver-plural/globals-math.js
  3. 4
      test/function/custom-path-resolver-plural/main.js

23
test/function/custom-path-resolver-plural/_config.js

@ -0,0 +1,23 @@
var path = require( 'path' );
var assert = require( 'assert' );
module.exports = {
description: 'uses custom path resolvers (plural)',
options: {
resolveId: [
function ( importee ) {
if ( importee[0] === '@' )
return path.resolve( __dirname, 'globals-' + importee.slice( 1 ).toLowerCase() + '.js' );
},
function ( importee ) {
if ( importee[0] === '!' ) return '<empty>';
}
],
load: function ( id ) {
if ( id === '<empty>' ) return '';
}
},
exports: function ( exports ) {
assert.strictEqual( exports.res, 0 );
}
};

2
test/function/custom-path-resolver-plural/globals-math.js

@ -0,0 +1,2 @@
export var sin = Math.sin;
export var cos = Math.cos;

4
test/function/custom-path-resolver-plural/main.js

@ -0,0 +1,4 @@
import { sin } from '@Math';
import '!path';
export var res = sin( 0 );
Loading…
Cancel
Save