19ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// Copyright 2011 the V8 project authors. All rights reserved.
29ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// Redistribution and use in source and binary forms, with or without
39ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// modification, are permitted provided that the following conditions are
49ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// met:
59ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//
69ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//     * Redistributions of source code must retain the above copyright
79ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//       notice, this list of conditions and the following disclaimer.
89ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//     * Redistributions in binary form must reproduce the above
99ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//       copyright notice, this list of conditions and the following
109ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//       disclaimer in the documentation and/or other materials provided
119ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//       with the distribution.
129ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//     * Neither the name of Google Inc. nor the names of its
139ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//       contributors may be used to endorse or promote products derived
149ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//       from this software without specific prior written permission.
159ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org//
169ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
179ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
189ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
199ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
209ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
219ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
229ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
239ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
249ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
259ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
269ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
279ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org
28c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org// Test that the expected string is parsed in the json parser when the length
29c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org// is so big that the string can't fit in new space, and it includes special
30c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org// characters.
319ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org
32c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.orgvar json = '{"key":"';
33c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.orgvar key = '';
34c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.orgvar expected = '';
35c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.orgfor(var i = 0; i < 60000; i++) {
36c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org  key = key + "TESTING" + i + "\\n";
37c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.org  expected = expected + "TESTING" + i + "\n";
389ee27ae43ab88e9bb6417ff9e27af64e0cf13729ager@chromium.org}
39c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.orgjson = json + key  + '"}';
40c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.orgvar out = JSON.parse(json);
41c54d36599f1e72bddd09d5b7a980304c7b638048ricow@chromium.orgassertEquals(expected, out.key);
42