| description( |
| 'This tests for caller property in functions. Only functions that are called from inside of other functions and have a parent should have this property set. Tests return true when caller is found and false when the caller is null.' |
| ) |
| function child() |
| { |
| return (child.caller !== null); |
| } |
| |
| function parent() |
| { |
| return child(); |
| } |
| |
| var childHasCallerWhenExecutingGlobalCode = (child.caller !== null); |
| var childHasCallerWhenCalledWithoutParent = child(); |
| var childHasCallerWhenCalledFromWithinParent = parent(); |
| |
| shouldBe('childHasCallerWhenExecutingGlobalCode', 'false'); |
| shouldBe('childHasCallerWhenCalledWithoutParent', 'false'); |
| shouldBe('childHasCallerWhenCalledFromWithinParent', 'true') |
| |
| var successfullyParsed = true; |