Mercurial > spidermonkey-playground
comparison tcb.js @ 21:cd5faa0bb46c
Added more tests for unwrap()/getWrapper().
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Mon, 22 Jun 2009 08:31:23 -0700 |
parents | 802ab1d478c6 |
children | 777839fbafeb |
comparison
equal
deleted
inserted
replaced
20:802ab1d478c6 | 21:cd5faa0bb46c |
---|---|
68 | 68 |
69 var wrapper = {}; | 69 var wrapper = {}; |
70 var wrappee = {}; | 70 var wrappee = {}; |
71 var wrapped = wrap(wrappee, wrapper); | 71 var wrapped = wrap(wrappee, wrapper); |
72 | 72 |
73 if (unwrap(wrapped) !== wrappee) | 73 if (unwrap({}) !== null) |
74 throw new Error("Unwrapping a non-wrapped object should return null!"); | |
75 | |
76 if (getWrapper({}) !== null) | |
77 throw new Error("Getting the wrapper of a non-wrapped object should " + | |
78 "return null!"); | |
79 | |
80 if (unwrap(wrapped) !== wrappee || | |
81 unwrap(unwrap(wrapped)) !== null) | |
74 throw new Error("Unwrapping doesn't work!"); | 82 throw new Error("Unwrapping doesn't work!"); |
75 | 83 |
76 if (getWrapper(wrapped) !== wrapper) | 84 if (getWrapper(wrapped) !== wrapper || |
85 getWrapper(getWrapper(wrapped)) !== null) | |
77 throw new Error("Getting the wrapper doesn't work!"); | 86 throw new Error("Getting the wrapper doesn't work!"); |