OLD | NEW |
(Empty) | |
| 1 dart_library.library('corelib/regexp/char-insensitive_test', null, /* Imports */
[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__char$45insensitive_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const dart = dart_sdk.dart; |
| 8 const dartx = dart_sdk.dartx; |
| 9 const expect$ = expect.expect; |
| 10 const char$45insensitive_test = Object.create(null); |
| 11 const v8_regexp_utils = Object.create(null); |
| 12 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.functionType(dart.void,
[])))(); |
| 13 let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String))
)(); |
| 14 let VoidTovoid$ = () => (VoidTovoid$ = dart.constFn(dart.definiteFunctionType(
dart.void, [])))(); |
| 15 let dynamicAnddynamic__Tovoid = () => (dynamicAnddynamic__Tovoid = dart.constF
n(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.Strin
g])))(); |
| 16 let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunct
ionType(dart.void, [dart.dynamic], [core.String])))(); |
| 17 let dynamic__Tovoid$ = () => (dynamic__Tovoid$ = dart.constFn(dart.definiteFun
ctionType(dart.void, [dart.dynamic], [core.num])))(); |
| 18 let dynamicAnddynamicAndnumTovoid = () => (dynamicAnddynamicAndnumTovoid = dar
t.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, core
.num])))(); |
| 19 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT
ype(dart.void, [dart.dynamic])))(); |
| 20 let StringAndRegExpToMatch = () => (StringAndRegExpToMatch = dart.constFn(dart
.definiteFunctionType(core.Match, [core.String, core.RegExp])))(); |
| 21 let MatchToString = () => (MatchToString = dart.constFn(dart.definiteFunctionT
ype(core.String, [core.Match])))(); |
| 22 let StringAndRegExpToListOfString = () => (StringAndRegExpToListOfString = dar
t.constFn(dart.definiteFunctionType(ListOfString(), [core.String, core.RegExp]))
)(); |
| 23 char$45insensitive_test.main = function() { |
| 24 v8_regexp_utils.description("This test checks the case-insensitive matching
of character literals."); |
| 25 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u00E5", {caseSensitive: fals
e}).hasMatch('new RegExp(r"å")')); |
| 26 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u00E5", {caseSensitive: fals
e}).hasMatch('new RegExp(r"Å")')); |
| 27 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u00C5", {caseSensitive: fals
e}).hasMatch('new RegExp(r"å")')); |
| 28 v8_regexp_utils.shouldBeTrue(core.RegExp.new("\\u00C5", {caseSensitive: fals
e}).hasMatch('new RegExp(r"Å")')); |
| 29 v8_regexp_utils.shouldBeFalse(core.RegExp.new("\\u00E5", {caseSensitive: fal
se}).hasMatch('P')); |
| 30 v8_regexp_utils.shouldBeFalse(core.RegExp.new("\\u00E5", {caseSensitive: fal
se}).hasMatch('PASS')); |
| 31 v8_regexp_utils.shouldBeFalse(core.RegExp.new("\\u00C5", {caseSensitive: fal
se}).hasMatch('P')); |
| 32 v8_regexp_utils.shouldBeFalse(core.RegExp.new("\\u00C5", {caseSensitive: fal
se}).hasMatch('PASS')); |
| 33 v8_regexp_utils.shouldBeNull(v8_regexp_utils.firstMatch('PASS', core.RegExp.
new("\\u00C5", {caseSensitive: false}))); |
| 34 v8_regexp_utils.shouldBeNull(v8_regexp_utils.firstMatch('PASS', core.RegExp.
new("\\u00C5", {caseSensitive: false}))); |
| 35 v8_regexp_utils.assertEquals('PASå'[dartx.replaceAll](core.RegExp.new("\\u00
E5", {caseSensitive: false}), 'S'), 'PASS'); |
| 36 v8_regexp_utils.assertEquals('PASå'[dartx.replaceAll](core.RegExp.new("\\u00
C5", {caseSensitive: false}), 'S'), 'PASS'); |
| 37 v8_regexp_utils.assertEquals('PASÅ'[dartx.replaceAll](core.RegExp.new("\\u00
E5", {caseSensitive: false}), 'S'), 'PASS'); |
| 38 v8_regexp_utils.assertEquals('PASÅ'[dartx.replaceAll](core.RegExp.new("\\u00
C5", {caseSensitive: false}), 'S'), 'PASS'); |
| 39 v8_regexp_utils.assertEquals('PASS'[dartx.replaceAll](core.RegExp.new("\\u00
E5", {caseSensitive: false}), '%C3%A5'), 'PASS'); |
| 40 v8_regexp_utils.assertEquals('PASS'[dartx.replaceAll](core.RegExp.new("\\u00
C5", {caseSensitive: false}), '%C3%A5'), 'PASS'); |
| 41 }; |
| 42 dart.fn(char$45insensitive_test.main, VoidTovoid$()); |
| 43 v8_regexp_utils.assertEquals = function(actual, expected, message) { |
| 44 if (message === void 0) message = null; |
| 45 expect$.Expect.equals(actual, expected, message); |
| 46 }; |
| 47 dart.fn(v8_regexp_utils.assertEquals, dynamicAnddynamic__Tovoid()); |
| 48 v8_regexp_utils.assertTrue = function(actual, message) { |
| 49 if (message === void 0) message = null; |
| 50 expect$.Expect.isTrue(actual, message); |
| 51 }; |
| 52 dart.fn(v8_regexp_utils.assertTrue, dynamic__Tovoid()); |
| 53 v8_regexp_utils.assertFalse = function(actual, message) { |
| 54 if (message === void 0) message = null; |
| 55 expect$.Expect.isFalse(actual, message); |
| 56 }; |
| 57 dart.fn(v8_regexp_utils.assertFalse, dynamic__Tovoid()); |
| 58 v8_regexp_utils.assertThrows = function(fn, testid) { |
| 59 if (testid === void 0) testid = null; |
| 60 expect$.Expect.throws(VoidTovoid()._check(fn), null, dart.str`Test ${testid}
`); |
| 61 }; |
| 62 dart.fn(v8_regexp_utils.assertThrows, dynamic__Tovoid$()); |
| 63 v8_regexp_utils.assertNull = function(actual, testid) { |
| 64 if (testid === void 0) testid = null; |
| 65 expect$.Expect.isNull(actual, dart.str`Test ${testid}`); |
| 66 }; |
| 67 dart.fn(v8_regexp_utils.assertNull, dynamic__Tovoid$()); |
| 68 v8_regexp_utils.assertToStringEquals = function(str, match, testid) { |
| 69 let actual = []; |
| 70 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(match, 'groupCo
unt'))); i++) { |
| 71 let g = dart.dsend(match, 'group', i); |
| 72 actual[dartx.add](g == null ? "" : g); |
| 73 } |
| 74 expect$.Expect.equals(str, actual[dartx.join](","), dart.str`Test ${testid}`
); |
| 75 }; |
| 76 dart.fn(v8_regexp_utils.assertToStringEquals, dynamicAnddynamicAndnumTovoid())
; |
| 77 v8_regexp_utils.shouldBeTrue = function(actual) { |
| 78 expect$.Expect.isTrue(actual); |
| 79 }; |
| 80 dart.fn(v8_regexp_utils.shouldBeTrue, dynamicTovoid()); |
| 81 v8_regexp_utils.shouldBeFalse = function(actual) { |
| 82 expect$.Expect.isFalse(actual); |
| 83 }; |
| 84 dart.fn(v8_regexp_utils.shouldBeFalse, dynamicTovoid()); |
| 85 v8_regexp_utils.shouldBeNull = function(actual) { |
| 86 expect$.Expect.isNull(actual); |
| 87 }; |
| 88 dart.fn(v8_regexp_utils.shouldBeNull, dynamicTovoid()); |
| 89 v8_regexp_utils.shouldBe = function(actual, expected, message) { |
| 90 if (message === void 0) message = null; |
| 91 if (expected == null) { |
| 92 expect$.Expect.isNull(actual, message); |
| 93 } else { |
| 94 expect$.Expect.equals(dart.dload(expected, 'length'), dart.dsend(dart.dloa
d(actual, 'groupCount'), '+', 1)); |
| 95 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(actual, 'grou
pCount'))); i++) { |
| 96 expect$.Expect.equals(dart.dindex(expected, i), dart.dsend(actual, 'grou
p', i), message); |
| 97 } |
| 98 } |
| 99 }; |
| 100 dart.fn(v8_regexp_utils.shouldBe, dynamicAnddynamic__Tovoid()); |
| 101 v8_regexp_utils.firstMatch = function(str, pattern) { |
| 102 return pattern.firstMatch(str); |
| 103 }; |
| 104 dart.fn(v8_regexp_utils.firstMatch, StringAndRegExpToMatch()); |
| 105 v8_regexp_utils.allStringMatches = function(str, pattern) { |
| 106 return pattern.allMatches(str)[dartx.map](core.String)(dart.fn(m => m.group(
0), MatchToString()))[dartx.toList](); |
| 107 }; |
| 108 dart.fn(v8_regexp_utils.allStringMatches, StringAndRegExpToListOfString()); |
| 109 v8_regexp_utils.description = function(str) { |
| 110 }; |
| 111 dart.fn(v8_regexp_utils.description, dynamicTovoid()); |
| 112 // Exports: |
| 113 exports.char$45insensitive_test = char$45insensitive_test; |
| 114 exports.v8_regexp_utils = v8_regexp_utils; |
| 115 }); |
OLD | NEW |