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