fix tests
This commit is contained in:
@@ -1119,11 +1119,11 @@ return {
|
||||
if (!caught) throw "stone object should prevent modification"
|
||||
},
|
||||
|
||||
test_stone_p_frozen: function() {
|
||||
test_is_stone_frozen: function() {
|
||||
var obj = {x: 10}
|
||||
if (stone.p(obj)) throw "stone.p should return false before freezing"
|
||||
if (is_stone(obj)) throw "stone.p should return false before freezing"
|
||||
stone(obj)
|
||||
if (!stone.p(obj)) throw "stone.p should return true after freezing"
|
||||
if (!is_stone(obj)) throw "stone.p should return true after freezing"
|
||||
},
|
||||
|
||||
test_stone_array: function() {
|
||||
@@ -3093,30 +3093,6 @@ return {
|
||||
// STONE FUNCTION (Additional Tests)
|
||||
// ============================================================================
|
||||
|
||||
test_stone_nested_object: function() {
|
||||
var obj = {inner: {value: 42}}
|
||||
stone(obj)
|
||||
var caught = false
|
||||
try {
|
||||
obj.inner.value = 99
|
||||
} catch (e) {
|
||||
caught = true
|
||||
}
|
||||
if (!caught) throw "stone should freeze nested objects"
|
||||
},
|
||||
|
||||
test_stone_nested_array: function() {
|
||||
var obj = {arr: [1, 2, 3]}
|
||||
stone(obj)
|
||||
var caught = false
|
||||
try {
|
||||
obj.arr[0] = 99
|
||||
} catch (e) {
|
||||
caught = true
|
||||
}
|
||||
if (!caught) throw "stone should freeze nested arrays"
|
||||
},
|
||||
|
||||
test_stone_returns_value: function() {
|
||||
var obj = {x: 1}
|
||||
var result = stone(obj)
|
||||
@@ -3127,7 +3103,7 @@ return {
|
||||
var obj = {x: 1}
|
||||
stone(obj)
|
||||
stone(obj)
|
||||
if (!stone.p(obj)) throw "stone should be idempotent"
|
||||
if (!is_stone(obj)) throw "stone should be idempotent"
|
||||
},
|
||||
|
||||
// ============================================================================
|
||||
|
||||
Reference in New Issue
Block a user