OLD | NEW |
(Empty) | |
| 1 dart_library.library('corelib/regexp/unicodeCaseInsensitive_test', null, /* Impo
rts */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__unicodeCaseInsensitive_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const _interceptors = dart_sdk._interceptors; |
| 8 const dart = dart_sdk.dart; |
| 9 const dartx = dart_sdk.dartx; |
| 10 const expect$ = expect.expect; |
| 11 const unicodeCaseInsensitive_test = Object.create(null); |
| 12 const v8_regexp_utils = Object.create(null); |
| 13 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); |
| 14 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.functionType(dart.void,
[])))(); |
| 15 let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String))
)(); |
| 16 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 17 let VoidTovoid$ = () => (VoidTovoid$ = dart.constFn(dart.definiteFunctionType(
dart.void, [])))(); |
| 18 let dynamicAnddynamic__Tovoid = () => (dynamicAnddynamic__Tovoid = dart.constF
n(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.Strin
g])))(); |
| 19 let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunct
ionType(dart.void, [dart.dynamic], [core.String])))(); |
| 20 let dynamic__Tovoid$ = () => (dynamic__Tovoid$ = dart.constFn(dart.definiteFun
ctionType(dart.void, [dart.dynamic], [core.num])))(); |
| 21 let dynamicAnddynamicAndnumTovoid = () => (dynamicAnddynamicAndnumTovoid = dar
t.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, core
.num])))(); |
| 22 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT
ype(dart.void, [dart.dynamic])))(); |
| 23 let StringAndRegExpToMatch = () => (StringAndRegExpToMatch = dart.constFn(dart
.definiteFunctionType(core.Match, [core.String, core.RegExp])))(); |
| 24 let MatchToString = () => (MatchToString = dart.constFn(dart.definiteFunctionT
ype(core.String, [core.Match])))(); |
| 25 let StringAndRegExpToListOfString = () => (StringAndRegExpToListOfString = dar
t.constFn(dart.definiteFunctionType(ListOfString(), [core.String, core.RegExp]))
)(); |
| 26 unicodeCaseInsensitive_test.main = function() { |
| 27 v8_regexp_utils.shouldBeTrue(core.RegExp.new("ΣΤΙΓΜΑΣ", {caseSensitive: fals
e}).hasMatch("στιγμας")); |
| 28 v8_regexp_utils.shouldBeTrue(core.RegExp.new("ΔΣΔ", {caseSensitive: false}).
hasMatch("δςδ")); |
| 29 v8_regexp_utils.shouldBeTrue(core.RegExp.new("ς", {caseSensitive: false}).ha
sMatch("σ")); |
| 30 v8_regexp_utils.shouldBeTrue(core.RegExp.new("σ", {caseSensitive: false}).ha
sMatch("ς")); |
| 31 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u1f16", {caseSensitive: fals
e}).hasMatch("")); |
| 32 function ucs2CodePoint(x) { |
| 33 return core.String.fromCharCode(core.int._check(x)); |
| 34 } |
| 35 dart.fn(ucs2CodePoint, dynamicTodynamic()); |
| 36 function testSet(s) { |
| 37 for (let i of core.Iterable._check(s)) { |
| 38 for (let j of core.Iterable._check(s)) { |
| 39 v8_regexp_utils.shouldBeTrue(core.RegExp.new(core.String._check(ucs2Co
dePoint(i)), {caseSensitive: false}).hasMatch(core.String._check(ucs2CodePoint(j
)))); |
| 40 v8_regexp_utils.shouldBeTrue(core.RegExp.new(dart.str`[${ucs2CodePoint
(dart.dsend(i, '-', 1))}-${ucs2CodePoint(dart.dsend(i, '+', 1))}]`, {caseSensiti
ve: false}).hasMatch(core.String._check(ucs2CodePoint(j)))); |
| 41 } |
| 42 } |
| 43 } |
| 44 dart.fn(testSet, dynamicTodynamic()); |
| 45 testSet(JSArrayOfint().of([452, 453, 454])); |
| 46 testSet(JSArrayOfint().of([455, 456, 457])); |
| 47 testSet(JSArrayOfint().of([458, 459, 460])); |
| 48 testSet(JSArrayOfint().of([497, 498, 499])); |
| 49 testSet(JSArrayOfint().of([914, 946, 976])); |
| 50 testSet(JSArrayOfint().of([917, 949, 1013])); |
| 51 testSet(JSArrayOfint().of([920, 952, 977])); |
| 52 testSet(JSArrayOfint().of([837, 921, 953, 8126])); |
| 53 testSet(JSArrayOfint().of([922, 954, 1008])); |
| 54 testSet(JSArrayOfint().of([181, 924, 956])); |
| 55 testSet(JSArrayOfint().of([928, 960, 982])); |
| 56 testSet(JSArrayOfint().of([929, 961, 1009])); |
| 57 testSet(JSArrayOfint().of([931, 962, 963])); |
| 58 testSet(JSArrayOfint().of([934, 966, 981])); |
| 59 testSet(JSArrayOfint().of([7776, 7777, 7835])); |
| 60 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u03cf", {caseSensitive: fals
e}).hasMatch("Ϗ")); |
| 61 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u03d7", {caseSensitive: fals
e}).hasMatch("Ϗ")); |
| 62 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u03cf", {caseSensitive: fals
e}).hasMatch("ϗ")); |
| 63 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u03d7", {caseSensitive: fals
e}).hasMatch("ϗ")); |
| 64 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u1f11", {caseSensitive: fals
e}).hasMatch("ἑ")); |
| 65 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u1f19", {caseSensitive: fals
e}).hasMatch("ἑ")); |
| 66 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u1f11", {caseSensitive: fals
e}).hasMatch("Ἑ")); |
| 67 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u1f19", {caseSensitive: fals
e}).hasMatch("Ἑ")); |
| 68 v8_regexp_utils.shouldBeFalse(core.RegExp.new("\\u0489", {caseSensitive: fal
se}).hasMatch("Ҋ")); |
| 69 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u048a", {caseSensitive: fals
e}).hasMatch("Ҋ")); |
| 70 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u048b", {caseSensitive: fals
e}).hasMatch("Ҋ")); |
| 71 v8_regexp_utils.shouldBeFalse(core.RegExp.new("\\u048c", {caseSensitive: fal
se}).hasMatch("Ҋ")); |
| 72 v8_regexp_utils.shouldBeFalse(core.RegExp.new("\\u0489", {caseSensitive: fal
se}).hasMatch("ҋ")); |
| 73 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u048a", {caseSensitive: fals
e}).hasMatch("ҋ")); |
| 74 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u048b", {caseSensitive: fals
e}).hasMatch("ҋ")); |
| 75 v8_regexp_utils.shouldBeFalse(core.RegExp.new("\\u048c", {caseSensitive: fal
se}).hasMatch("ҋ")); |
| 76 v8_regexp_utils.shouldBeTrue(core.RegExp.new("[\\u0489-\\u048a]", {caseSensi
tive: false}).hasMatch("ҋ")); |
| 77 v8_regexp_utils.shouldBeTrue(core.RegExp.new("[\\u048b-\\u048c]", {caseSensi
tive: false}).hasMatch("Ҋ")); |
| 78 v8_regexp_utils.shouldBeFalse(core.RegExp.new("\\u04c4", {caseSensitive: fal
se}).hasMatch("Ӆ")); |
| 79 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u04c5", {caseSensitive: fals
e}).hasMatch("Ӆ")); |
| 80 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u04c6", {caseSensitive: fals
e}).hasMatch("Ӆ")); |
| 81 v8_regexp_utils.shouldBeFalse(core.RegExp.new("\\u04c7", {caseSensitive: fal
se}).hasMatch("Ӆ")); |
| 82 v8_regexp_utils.shouldBeFalse(core.RegExp.new("\\u04c4", {caseSensitive: fal
se}).hasMatch("ӆ")); |
| 83 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u04c5", {caseSensitive: fals
e}).hasMatch("ӆ")); |
| 84 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u04c6", {caseSensitive: fals
e}).hasMatch("ӆ")); |
| 85 v8_regexp_utils.shouldBeFalse(core.RegExp.new("\\u04c7", {caseSensitive: fal
se}).hasMatch("ӆ")); |
| 86 v8_regexp_utils.shouldBeTrue(core.RegExp.new("[\\u04c4-\\u04c5]", {caseSensi
tive: false}).hasMatch("ӆ")); |
| 87 v8_regexp_utils.shouldBeTrue(core.RegExp.new("[\\u04c6-\\u04c7]", {caseSensi
tive: false}).hasMatch("Ӆ")); |
| 88 let successfullyParsed = true; |
| 89 }; |
| 90 dart.fn(unicodeCaseInsensitive_test.main, VoidTovoid$()); |
| 91 v8_regexp_utils.assertEquals = function(actual, expected, message) { |
| 92 if (message === void 0) message = null; |
| 93 expect$.Expect.equals(actual, expected, message); |
| 94 }; |
| 95 dart.fn(v8_regexp_utils.assertEquals, dynamicAnddynamic__Tovoid()); |
| 96 v8_regexp_utils.assertTrue = function(actual, message) { |
| 97 if (message === void 0) message = null; |
| 98 expect$.Expect.isTrue(actual, message); |
| 99 }; |
| 100 dart.fn(v8_regexp_utils.assertTrue, dynamic__Tovoid()); |
| 101 v8_regexp_utils.assertFalse = function(actual, message) { |
| 102 if (message === void 0) message = null; |
| 103 expect$.Expect.isFalse(actual, message); |
| 104 }; |
| 105 dart.fn(v8_regexp_utils.assertFalse, dynamic__Tovoid()); |
| 106 v8_regexp_utils.assertThrows = function(fn, testid) { |
| 107 if (testid === void 0) testid = null; |
| 108 expect$.Expect.throws(VoidTovoid()._check(fn), null, dart.str`Test ${testid}
`); |
| 109 }; |
| 110 dart.fn(v8_regexp_utils.assertThrows, dynamic__Tovoid$()); |
| 111 v8_regexp_utils.assertNull = function(actual, testid) { |
| 112 if (testid === void 0) testid = null; |
| 113 expect$.Expect.isNull(actual, dart.str`Test ${testid}`); |
| 114 }; |
| 115 dart.fn(v8_regexp_utils.assertNull, dynamic__Tovoid$()); |
| 116 v8_regexp_utils.assertToStringEquals = function(str, match, testid) { |
| 117 let actual = []; |
| 118 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(match, 'groupCo
unt'))); i++) { |
| 119 let g = dart.dsend(match, 'group', i); |
| 120 actual[dartx.add](g == null ? "" : g); |
| 121 } |
| 122 expect$.Expect.equals(str, actual[dartx.join](","), dart.str`Test ${testid}`
); |
| 123 }; |
| 124 dart.fn(v8_regexp_utils.assertToStringEquals, dynamicAnddynamicAndnumTovoid())
; |
| 125 v8_regexp_utils.shouldBeTrue = function(actual) { |
| 126 expect$.Expect.isTrue(actual); |
| 127 }; |
| 128 dart.fn(v8_regexp_utils.shouldBeTrue, dynamicTovoid()); |
| 129 v8_regexp_utils.shouldBeFalse = function(actual) { |
| 130 expect$.Expect.isFalse(actual); |
| 131 }; |
| 132 dart.fn(v8_regexp_utils.shouldBeFalse, dynamicTovoid()); |
| 133 v8_regexp_utils.shouldBeNull = function(actual) { |
| 134 expect$.Expect.isNull(actual); |
| 135 }; |
| 136 dart.fn(v8_regexp_utils.shouldBeNull, dynamicTovoid()); |
| 137 v8_regexp_utils.shouldBe = function(actual, expected, message) { |
| 138 if (message === void 0) message = null; |
| 139 if (expected == null) { |
| 140 expect$.Expect.isNull(actual, message); |
| 141 } else { |
| 142 expect$.Expect.equals(dart.dload(expected, 'length'), dart.dsend(dart.dloa
d(actual, 'groupCount'), '+', 1)); |
| 143 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(actual, 'grou
pCount'))); i++) { |
| 144 expect$.Expect.equals(dart.dindex(expected, i), dart.dsend(actual, 'grou
p', i), message); |
| 145 } |
| 146 } |
| 147 }; |
| 148 dart.fn(v8_regexp_utils.shouldBe, dynamicAnddynamic__Tovoid()); |
| 149 v8_regexp_utils.firstMatch = function(str, pattern) { |
| 150 return pattern.firstMatch(str); |
| 151 }; |
| 152 dart.fn(v8_regexp_utils.firstMatch, StringAndRegExpToMatch()); |
| 153 v8_regexp_utils.allStringMatches = function(str, pattern) { |
| 154 return pattern.allMatches(str)[dartx.map](core.String)(dart.fn(m => m.group(
0), MatchToString()))[dartx.toList](); |
| 155 }; |
| 156 dart.fn(v8_regexp_utils.allStringMatches, StringAndRegExpToListOfString()); |
| 157 v8_regexp_utils.description = function(str) { |
| 158 }; |
| 159 dart.fn(v8_regexp_utils.description, dynamicTovoid()); |
| 160 // Exports: |
| 161 exports.unicodeCaseInsensitive_test = unicodeCaseInsensitive_test; |
| 162 exports.v8_regexp_utils = v8_regexp_utils; |
| 163 }); |
OLD | NEW |