Test use cases for prop valueOf & toString
This commit is contained in:
parent
8f17472bcc
commit
adaef70729
1 changed files with 141 additions and 128 deletions
|
|
@ -717,6 +717,19 @@ o.spec("stream", function() {
|
|||
o(Stream.stream([1, 2, 3]).valueOf()).deepEquals([1, 2, 3])
|
||||
o(Stream.stream().valueOf()).equals(undefined)
|
||||
})
|
||||
o("allows implicit value access in mathematical operations", function() {
|
||||
o(Stream.stream(1) + Stream.stream(1)).equals(2)
|
||||
})
|
||||
})
|
||||
o.spec("toString", function() {
|
||||
o("aliases valueOf", function() {
|
||||
var stream = Stream.stream(1)
|
||||
|
||||
o(stream.toString).equals(stream.valueOf)
|
||||
})
|
||||
o("allows implicit value access in string operations", function() {
|
||||
o(Stream.stream("a") + Stream.stream("b")).equals("ab")
|
||||
})
|
||||
})
|
||||
o.spec("toJSON", function() {
|
||||
o("works", function() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue