From b4c633fc4f9a0159604cf0269784a6c7cb792911 Mon Sep 17 00:00:00 2001 From: Kevin Gibbons Date: Thu, 20 Oct 2016 11:41:31 -0700 Subject: [PATCH] Add test for inequality of RegExps created from the same source (#776) --- test/language/literals/regexp/inequality.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 test/language/literals/regexp/inequality.js diff --git a/test/language/literals/regexp/inequality.js b/test/language/literals/regexp/inequality.js new file mode 100644 index 0000000000..2c953c8e8b --- /dev/null +++ b/test/language/literals/regexp/inequality.js @@ -0,0 +1,19 @@ +// Copyright (C) 2016 Kevin Gibbons. All rights reserved. +// This code is governed by the BSD license found in the LICENSE file. +/*--- +description: Regular expression literals should not compare as equal even if they appear in the same source position. +esid: sec-regular-expression-literals-runtime-semantics-evaluation +---*/ + +function makeRegExp() { + return /(?:)/; +} + +assert.notSameValue(makeRegExp(), makeRegExp()); + +var values = []; +for (var i = 0; i < 2; ++i) { + values[i] = /(?:)/; +} + +assert.notSameValue(values[0], values[1]);