Created
January 25, 2010 10:29
-
-
Save anekos/285774 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 以下の assert は全部通る。 | |
let a1 = [{}, 1, 2]; | |
let a2 = a1.concat(); | |
assertEqual('A0', false, function () a1 === a2); | |
assertEqual('A1', false, function () a1 === ({})); | |
assertEqual('A2', true, function () a1[0] === a2[0]); | |
let b1 = [{}, 1, 2]; | |
let b2 = b1.concat(); | |
b1[0]['hoge'] = 'moge'; | |
assertEqual('B0', false, function () b1 === b2); | |
assertEqual('B1', true, function () b1[0] === b2[0]); | |
assertEqual('B2', 'moge', function () b1[0].hoge); | |
assertEqual('B3', 'moge', function () b2[0].hoge); | |
let c1 = [['moge'], 1, 2]; | |
let c2 = c1.concat(); | |
c1[0][0] = 'hage'; | |
assertEqual('C0', false, function () c1 === c2); | |
assertEqual('C1', true, function () c1[0] === c2[0]); | |
assertEqual('C2', 'hage', function () c1[0][0]); | |
assertEqual('C3', 'hage', function () c2[0][0]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment