OLD | NEW |
(Empty) | |
| 1 dart_library.library('corelib/regexp/character-match-out-of-order_test', null, /
* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__character$45match$45out$45of$45order_test(exports, dart_sdk, e
xpect) { |
| 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 character$45match$45out$45of$45order_test = Object.create(null); |
| 12 const v8_regexp_utils = Object.create(null); |
| 13 let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSAr
ray$(core.String)))(); |
| 14 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.functionType(dart.void,
[])))(); |
| 15 let ListOfString = () => (ListOfString = dart.constFn(core.List$(core.String))
)(); |
| 16 let VoidTovoid$ = () => (VoidTovoid$ = dart.constFn(dart.definiteFunctionType(
dart.void, [])))(); |
| 17 let dynamicAnddynamic__Tovoid = () => (dynamicAnddynamic__Tovoid = dart.constF
n(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic], [core.Strin
g])))(); |
| 18 let dynamic__Tovoid = () => (dynamic__Tovoid = dart.constFn(dart.definiteFunct
ionType(dart.void, [dart.dynamic], [core.String])))(); |
| 19 let dynamic__Tovoid$ = () => (dynamic__Tovoid$ = dart.constFn(dart.definiteFun
ctionType(dart.void, [dart.dynamic], [core.num])))(); |
| 20 let dynamicAnddynamicAndnumTovoid = () => (dynamicAnddynamicAndnumTovoid = dar
t.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, core
.num])))(); |
| 21 let dynamicTovoid = () => (dynamicTovoid = dart.constFn(dart.definiteFunctionT
ype(dart.void, [dart.dynamic])))(); |
| 22 let StringAndRegExpToMatch = () => (StringAndRegExpToMatch = dart.constFn(dart
.definiteFunctionType(core.Match, [core.String, core.RegExp])))(); |
| 23 let MatchToString = () => (MatchToString = dart.constFn(dart.definiteFunctionT
ype(core.String, [core.Match])))(); |
| 24 let StringAndRegExpToListOfString = () => (StringAndRegExpToListOfString = dar
t.constFn(dart.definiteFunctionType(ListOfString(), [core.String, core.RegExp]))
)(); |
| 25 character$45match$45out$45of$45order_test.main = function() { |
| 26 v8_regexp_utils.description('Test to ensure RegExp generates single characte
r matches in the correct order'); |
| 27 v8_regexp_utils.shouldBe(core.RegExp.new("[\\w']+").firstMatch("'_'"), JSArr
ayOfString().of(["'_'"])); |
| 28 }; |
| 29 dart.fn(character$45match$45out$45of$45order_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.character$45match$45out$45of$45order_test = character$45match$45out$45
of$45order_test; |
| 101 exports.v8_regexp_utils = v8_regexp_utils; |
| 102 }); |
OLD | NEW |