summaryrefslogtreecommitdiffstats
path: root/js/src/tests/test262/built-ins/String/prototype/replace/S15.5.4.11_A5_T1.js
blob: 491d0ae818e21b219ff128034af68133df1b78a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright 2009 the Sputnik authors.  All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.

/*---
info: Use replace with regexp as searchValue and use $ in replaceValue
es5id: 15.5.4.11_A5_T1
description: searchValue is  regexp /^(a+)\1*,\1+$/ and replaceValue is "$1"
---*/

var __str = "aaaaaaaaaa,aaaaaaaaaaaaaaa";
var __pattern = /^(a+)\1*,\1+$/;
var __repl = "$1";

//////////////////////////////////////////////////////////////////////////////
//CHECK#1
if (__str.replace(__pattern, __repl) !== 'aaaaa') {
  throw new Test262Error('#1: var __str = "aaaaaaaaaa,aaaaaaaaaaaaaaa"; var __pattern = /^(a+)\\1*,\\1+$/; var __repl = "$1"; __str.replace(__pattern, __repl)===\'aaaaa\'. Actual: ' + __str.replace(__pattern, __repl));
}
//
//////////////////////////////////////////////////////////////////////////////

reportCompare(0, 0);