diff options
| author | Dhruv Manek | 2011-12-18 18:33:25 -0800 | 
|---|---|---|
| committer | Igor Minar | 2012-01-06 12:19:39 -0800 | 
| commit | 08029c7b72a857ffe52f302ed79ae12db9efcc08 (patch) | |
| tree | b51e6657d2a5f7d373ab67f3a076076001af4162 /test | |
| parent | 0bf611087b2773fd36cf95c938d1cda8e65ffb2b (diff) | |
| download | angular.js-08029c7b72a857ffe52f302ed79ae12db9efcc08.tar.bz2 | |
fix(angular.copy): throw Error if source and destination are identical
Closes #693
Diffstat (limited to 'test')
| -rw-r--r-- | test/AngularSpec.js | 8 | 
1 files changed, 8 insertions, 0 deletions
| diff --git a/test/AngularSpec.js b/test/AngularSpec.js index 1cb6af5e..70997240 100644 --- a/test/AngularSpec.js +++ b/test/AngularSpec.js @@ -65,6 +65,14 @@ describe('angular', function() {      it('should throw an exception if a Window is being copied', function() {        expect(function() { copy(window); }).toThrow("Can't copy Window or Scope");      }); + +    it('should throw an exception when source and destination are equivalent', function() { +      var src, dst; +	    src = dst = {key: 'value'}; +      expect(function() { copy(src, dst); }).toThrow("Can't copy equivalent objects or arrays"); +      src = dst = [2, 4]; +      expect(function() { copy(src, dst); }).toThrow("Can't copy equivalent objects or arrays"); +    });    });    describe('equals', function() { | 
