From 3090e86c251690433b099e650052da646952d11e Mon Sep 17 00:00:00 2001 From: David Glasser Date: Tue, 14 May 2013 11:43:44 -0700 Subject: [PATCH] Oops, didn't mean to revert test! --- packages/ejson/ejson_test.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/packages/ejson/ejson_test.js b/packages/ejson/ejson_test.js index 4f1e6b6ac65..bd3e5d63104 100644 --- a/packages/ejson/ejson_test.js +++ b/packages/ejson/ejson_test.js @@ -51,3 +51,24 @@ Tinytest.add("ejson - equality and falsiness", function (test) { test.isFalse(EJSON.equals(undefined, {foo: "foo"})); test.isFalse(EJSON.equals({foo: "foo"}, undefined)); }); + +Tinytest.add("ejson - clone", function (test) { + var cloneTest = function (x, identical) { + var y = EJSON.clone(x); + test.isTrue(EJSON.equals(x, y)); + test.equal(x === y, !!identical); + }; + cloneTest(null, true); + cloneTest(undefined, true); + cloneTest(42, true); + cloneTest("asdf", true); + cloneTest([1, 2, 3]); + cloneTest([1, "fasdf", {foo: 42}]); + cloneTest({x: 42, y: "asdf"}); + + var testCloneArgs = function (/*arguments*/) { + var clonedArgs = EJSON.clone(arguments); + test.equal(clonedArgs, [1, 2, "foo", [4]]); + }; + testCloneArgs(1, 2, "foo", [4]); +});