mirror of https://github.com/lukechilds/rollup.git
Rich Harris
9 years ago
5 changed files with 42 additions and 2 deletions
@ -0,0 +1,35 @@ |
|||
var assert = require( 'assert' ); |
|||
|
|||
module.exports = { |
|||
description: 'namespaces should be non-extensible and its properties immutatable and non-configurable', |
|||
|
|||
exports: function ( exports ) { |
|||
const ns = exports.ns; |
|||
|
|||
function extend ( obj ) { |
|||
'use strict'; |
|||
obj.newProperty = true; |
|||
} |
|||
|
|||
function reconfigure ( obj ) { |
|||
Object.defineProperty( obj, 'a', { value: null } ); |
|||
} |
|||
|
|||
function mutate ( obj ) { |
|||
'use strict'; |
|||
obj.a = 2; |
|||
} |
|||
|
|||
assert.throws(function () { |
|||
extend( ns ); |
|||
}); |
|||
|
|||
assert.throws(function () { |
|||
reconfigure( ns ); |
|||
}); |
|||
|
|||
assert.throws(function () { |
|||
mutate( ns ); |
|||
}); |
|||
} |
|||
}; |
@ -0,0 +1,3 @@ |
|||
import * as ns from './mod'; |
|||
|
|||
export { ns }; |
@ -0,0 +1,2 @@ |
|||
export var a = 1; |
|||
export var b = 2; |
Loading…
Reference in new issue