OLD | NEW |
(Empty) | |
| 1 dart_library.library('corelib/regexp/norepeat_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__norepeat_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 norepeat_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 norepeat_test.main = function() { |
| 24 v8_regexp_utils.description('Test for https://bugs.webkit.org/show_bug.cgi?i
d=46077'); |
| 25 let re = core.RegExp.new("^b|^cd"); |
| 26 let str = "abcd"; |
| 27 v8_regexp_utils.shouldBeFalse(re.hasMatch(str)); |
| 28 }; |
| 29 dart.fn(norepeat_test.main, VoidTovoid$()); |
| 30 v8_regexp_utils.assertEquals = function(actual, expected, message) { |
| 31 if (message === void 0) message = null; |
| 32 expect$.Expect.equals(actual, expected, message); |
| 33 }; |
| 34 dart.fn(v8_regexp_utils.assertEquals, dynamicAnddynamic__Tovoid()); |
| 35 v8_regexp_utils.assertTrue = function(actual, message) { |
| 36 if (message === void 0) message = null; |
| 37 expect$.Expect.isTrue(actual, message); |
| 38 }; |
| 39 dart.fn(v8_regexp_utils.assertTrue, dynamic__Tovoid()); |
| 40 v8_regexp_utils.assertFalse = function(actual, message) { |
| 41 if (message === void 0) message = null; |
| 42 expect$.Expect.isFalse(actual, message); |
| 43 }; |
| 44 dart.fn(v8_regexp_utils.assertFalse, dynamic__Tovoid()); |
| 45 v8_regexp_utils.assertThrows = function(fn, testid) { |
| 46 if (testid === void 0) testid = null; |
| 47 expect$.Expect.throws(VoidTovoid()._check(fn), null, dart.str`Test ${testid}
`); |
| 48 }; |
| 49 dart.fn(v8_regexp_utils.assertThrows, dynamic__Tovoid$()); |
| 50 v8_regexp_utils.assertNull = function(actual, testid) { |
| 51 if (testid === void 0) testid = null; |
| 52 expect$.Expect.isNull(actual, dart.str`Test ${testid}`); |
| 53 }; |
| 54 dart.fn(v8_regexp_utils.assertNull, dynamic__Tovoid$()); |
| 55 v8_regexp_utils.assertToStringEquals = function(str, match, testid) { |
| 56 let actual = []; |
| 57 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(match, 'groupCo
unt'))); i++) { |
| 58 let g = dart.dsend(match, 'group', i); |
| 59 actual[dartx.add](g == null ? "" : g); |
| 60 } |
| 61 expect$.Expect.equals(str, actual[dartx.join](","), dart.str`Test ${testid}`
); |
| 62 }; |
| 63 dart.fn(v8_regexp_utils.assertToStringEquals, dynamicAnddynamicAndnumTovoid())
; |
| 64 v8_regexp_utils.shouldBeTrue = function(actual) { |
| 65 expect$.Expect.isTrue(actual); |
| 66 }; |
| 67 dart.fn(v8_regexp_utils.shouldBeTrue, dynamicTovoid()); |
| 68 v8_regexp_utils.shouldBeFalse = function(actual) { |
| 69 expect$.Expect.isFalse(actual); |
| 70 }; |
| 71 dart.fn(v8_regexp_utils.shouldBeFalse, dynamicTovoid()); |
| 72 v8_regexp_utils.shouldBeNull = function(actual) { |
| 73 expect$.Expect.isNull(actual); |
| 74 }; |
| 75 dart.fn(v8_regexp_utils.shouldBeNull, dynamicTovoid()); |
| 76 v8_regexp_utils.shouldBe = function(actual, expected, message) { |
| 77 if (message === void 0) message = null; |
| 78 if (expected == null) { |
| 79 expect$.Expect.isNull(actual, message); |
| 80 } else { |
| 81 expect$.Expect.equals(dart.dload(expected, 'length'), dart.dsend(dart.dloa
d(actual, 'groupCount'), '+', 1)); |
| 82 for (let i = 0; i <= dart.notNull(core.num._check(dart.dload(actual, 'grou
pCount'))); i++) { |
| 83 expect$.Expect.equals(dart.dindex(expected, i), dart.dsend(actual, 'grou
p', i), message); |
| 84 } |
| 85 } |
| 86 }; |
| 87 dart.fn(v8_regexp_utils.shouldBe, dynamicAnddynamic__Tovoid()); |
| 88 v8_regexp_utils.firstMatch = function(str, pattern) { |
| 89 return pattern.firstMatch(str); |
| 90 }; |
| 91 dart.fn(v8_regexp_utils.firstMatch, StringAndRegExpToMatch()); |
| 92 v8_regexp_utils.allStringMatches = function(str, pattern) { |
| 93 return pattern.allMatches(str)[dartx.map](core.String)(dart.fn(m => m.group(
0), MatchToString()))[dartx.toList](); |
| 94 }; |
| 95 dart.fn(v8_regexp_utils.allStringMatches, StringAndRegExpToListOfString()); |
| 96 v8_regexp_utils.description = function(str) { |
| 97 }; |
| 98 dart.fn(v8_regexp_utils.description, dynamicTovoid()); |
| 99 // Exports: |
| 100 exports.norepeat_test = norepeat_test; |
| 101 exports.v8_regexp_utils = v8_regexp_utils; |
| 102 }); |
OLD | NEW |