2016-03-11 07:18:38 +00:00
|
|
|
// Copyright 2016 the V8 project authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2016-06-24 01:11:08 +00:00
|
|
|
// Flags: --harmony-regexp-property
|
2016-03-11 07:18:38 +00:00
|
|
|
|
|
|
|
function t(re, s) { assertTrue(re.test(s)); }
|
|
|
|
function f(re, s) { assertFalse(re.test(s)); }
|
|
|
|
|
2016-04-08 05:39:26 +00:00
|
|
|
t(/\p{Block=ASCII}+/u, ".");
|
|
|
|
t(/\p{Block=ASCII}+/u, "supercalifragilisticexpialidocious");
|
|
|
|
t(/\p{Block=Basic_Latin}+/u, ".");
|
|
|
|
t(/\p{Block=Basic_Latin}+/u, "supercalifragilisticexpialidocious");
|
|
|
|
|
|
|
|
t(/\p{blk=CJK}+/u, "话说天下大势,分久必合,合久必分");
|
|
|
|
t(/\p{blk=CJK_Unified_Ideographs}+/u, "吾庄后有一桃园,花开正盛");
|
|
|
|
f(/\p{blk=CJK}+/u, "おはようございます");
|
|
|
|
f(/\p{blk=CJK_Unified_Ideographs}+/u,
|
2016-03-11 07:18:38 +00:00
|
|
|
"Something is rotten in the state of Denmark");
|
|
|
|
|
2016-04-08 05:39:26 +00:00
|
|
|
t(/\p{blk=Latin_1}+/u, "Wie froh bin ich, daß ich weg bin!");
|
|
|
|
f(/\p{blk=Latin_1_Supplement}+/u, "奔腾千里荡尘埃,渡水登山紫雾开");
|
|
|
|
f(/\p{blk=Latin_1_Sup}+/u, "いただきます");
|
2016-03-11 07:18:38 +00:00
|
|
|
|
2016-04-08 05:39:26 +00:00
|
|
|
t(/\p{blk=Hiragana}/u, "いただきます");
|
|
|
|
t(/\p{sc=Hiragana}/u, "\u{1b001}"); // This refers to the script "Hiragana".
|
|
|
|
f(/\p{blk=Hiragana}/u, "\u{1b001}"); // This refers to the block "Hiragana".
|
2016-03-11 07:18:38 +00:00
|
|
|
|
2016-04-08 05:39:26 +00:00
|
|
|
t(/\p{blk=Greek_And_Coptic}/u,
|
2016-03-21 19:21:22 +00:00
|
|
|
"ἄνδρα μοι ἔννεπε, μοῦσα, πολύτροπον, ὃς μάλα πολλὰ");
|
2016-04-08 05:39:26 +00:00
|
|
|
t(/\p{blk=Greek}/u, "μῆνιν ἄειδε θεὰ Πηληϊάδεω Ἀχιλῆος");
|
2016-03-11 07:18:38 +00:00
|
|
|
|
|
|
|
assertThrows("/\\p{In}/u");
|
|
|
|
assertThrows("/\\pI/u");
|
|
|
|
assertThrows("/\\p{I}/u");
|
|
|
|
assertThrows("/\\p{CJK}/u");
|