Skip to content

Commit

Permalink
[tests] add comments to Number#toPrecision tests
Browse files Browse the repository at this point in the history
  • Loading branch information
zloirock committed Jan 31, 2016
1 parent b4404bd commit 8f939d5
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 80 deletions.
36 changes: 18 additions & 18 deletions tests/es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 18 additions & 18 deletions tests/library.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions tests/library/es6.number.to-precision.ls
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ module \ES6
test 'Number#toPrecision' (assert)!->
{toPrecision} = core.Number
assert.isFunction toPrecision
assert.same toPrecision(0.00008 3), '0.0000800'
assert.same toPrecision(1.255 2), '1.3'
assert.same toPrecision(1843654265.0774949 13), '1843654265.077'
assert.same toPrecision(NaN, 1), 'NaN'
assert.same toPrecision(123.456), '123.456'
assert.same toPrecision(123.456 void), '123.456'
assert.throws (!-> toPrecision 0.9 0), RangeError
assert.throws (!-> toPrecision 0.9 101), RangeError
assert.throws (-> toPrecision {}, 1), TypeError
assert.throws (-> toPrecision \123, 1), TypeError
assert.throws (-> toPrecision no, 1), TypeError
assert.throws (-> toPrecision null, 1), TypeError
assert.throws (-> toPrecision void, 1), TypeError
assert.same toPrecision(0.00008 3), '0.0000800', '0.00008.toPrecision(3)'
assert.same toPrecision(1.255 2), '1.3', '1.255.toPrecision(2)'
assert.same toPrecision(1843654265.0774949 13), '1843654265.077', '1843654265.0774949.toPrecision(13)'
assert.same toPrecision(NaN, 1), 'NaN', 'If x is NaN, return the String "NaN".'
assert.same toPrecision(123.456), '123.456', 'If precision is undefined, return ! ToString(x).'
assert.same toPrecision(123.456 void), '123.456', 'If precision is undefined, return ! ToString(x).'
assert.throws (!-> toPrecision 0.9 0), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'
assert.throws (!-> toPrecision 0.9 101), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'
assert.throws (!-> toPrecision {}, 1), TypeError, '? thisNumberValue(this value)'
assert.throws (!-> toPrecision \123, 1), TypeError, '? thisNumberValue(this value)'
assert.throws (!-> toPrecision no, 1), TypeError, '? thisNumberValue(this value)'
assert.throws (!-> toPrecision null, 1), TypeError, '? thisNumberValue(this value)'
assert.throws (!-> toPrecision void, 1), TypeError, '? thisNumberValue(this value)'
36 changes: 18 additions & 18 deletions tests/tests.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 13 additions & 13 deletions tests/tests/es6.number.to-precision.ls
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ test 'Number#toPrecision' (assert)!->
assert.name toPrecision, \toPrecision
assert.arity toPrecision, 1
assert.looksNative toPrecision
assert.same 0.00008.toPrecision(3), '0.0000800'
assert.same 1.255.toPrecision(2), '1.3'
assert.same 1843654265.0774949.toPrecision(13), '1843654265.077'
assert.same NaN.toPrecision(1), 'NaN'
assert.same 123.456.toPrecision!, '123.456'
assert.same 123.456.toPrecision(void), '123.456'
assert.throws (!-> 0.9.toPrecision 0), RangeError
assert.throws (!-> 0.9.toPrecision 101), RangeError
assert.throws (-> toPrecision.call {}, 1), TypeError
assert.throws (-> toPrecision.call \123, 1), TypeError
assert.throws (-> toPrecision.call no, 1), TypeError
assert.throws (-> toPrecision.call null, 1), TypeError
assert.throws (-> toPrecision.call void, 1), TypeError
assert.same 0.00008.toPrecision(3), '0.0000800', '0.00008.toPrecision(3)'
assert.same 1.255.toPrecision(2), '1.3', '1.255.toPrecision(2)'
assert.same 1843654265.0774949.toPrecision(13), '1843654265.077', '1843654265.0774949.toPrecision(13)'
assert.same NaN.toPrecision(1), 'NaN', 'If x is NaN, return the String "NaN".'
assert.same 123.456.toPrecision!, '123.456', 'If precision is undefined, return ! ToString(x).'
assert.same 123.456.toPrecision(void), '123.456', 'If precision is undefined, return ! ToString(x).'
assert.throws (!-> 0.9.toPrecision 0), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'
assert.throws (!-> 0.9.toPrecision 101), RangeError, 'If p < 1 or p > 21, throw a RangeError exception.'
assert.throws (!-> toPrecision.call {}, 1), TypeError, '? thisNumberValue(this value)'
assert.throws (!-> toPrecision.call \123, 1), TypeError, '? thisNumberValue(this value)'
assert.throws (!-> toPrecision.call no, 1), TypeError, '? thisNumberValue(this value)'
assert.throws (!-> toPrecision.call null, 1), TypeError, '? thisNumberValue(this value)'
assert.throws (!-> toPrecision.call void, 1), TypeError, '? thisNumberValue(this value)'

0 comments on commit 8f939d5

Please sign in to comment.