public void ImageTestsInfoboxes() { RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| image = [[File:Test.JPG]] | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| image2 = [[File:Test.JPG]] | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| img = [[File:Test.JPG]] | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| cover = [[File:Test.JPG]] | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| cover art = [[File:Test.JPG]] | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| cover_ar = Test.JPG | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a|map=[[File:Test.JPG]] | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| map = [[File:Test.JPG]] | there=here}}"); }
public void DisambigsTests() { RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disambig|surname}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{ disambig|surname }}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disambig|page=Foo|page2=Bar}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disamb}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disamb }}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disamb|}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disamb|foo}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{dab}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{Disambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{surname}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{hndis}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{ disambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{Template:disambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{template:disambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{Shipindex}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{mountainindex}}"); RegexAssert.NoMatch(WikiRegexes.Disambigs, @"{{now disambig}}"); RegexAssert.NoMatch(WikiRegexes.Disambigs, @"{{dablink|foo}}"); RegexAssert.NoMatch(WikiRegexes.Disambigs, @"{{surname-stub}}"); }
public void DisambigsTests() { RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disambig|surname}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{ disambig|surname }}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disambig|page=Foo|page2=Bar}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disamb}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disamb }}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disamb|}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{disamb|foo}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{dab}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{Disambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{Numberdis}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{numberdis}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{Letter-NumberCombdisambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{Letter-NumberCombDisambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{hndis}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{ disambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{Template:disambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{template:disambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{LatinNameDisambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{SpeciesLatinNameDisambig}}"); RegexAssert.IsMatch(WikiRegexes.Disambigs, @"{{Hurricane season disambiguation}}"); RegexAssert.NoMatch(WikiRegexes.Disambigs, @"{{now disambig}}"); RegexAssert.NoMatch(WikiRegexes.Disambigs, @"{{dablink|foo}}"); }
public void StubTests() { RegexAssert.IsMatch(WikiRegexes.Stub, @"{{footballer-bio-stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{ footballer-bio-stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{ Footballer-Bio-Stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{bio-stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{ stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{Stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{-stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{Japan-spacecraft-stub|nocat=yes}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{Japan-spacecraft-stub|date=August 2012}}"); RegexAssert.NoMatch(WikiRegexes.Stub, @"{{now stubborn}}"); RegexAssert.NoMatch(WikiRegexes.Stub, @"{{stubby}}"); RegexAssert.NoMatch(WikiRegexes.Stub, @"{{foo|stub}}"); RegexAssert.NoMatch(WikiRegexes.Stub, @":{{main|stub (electronics)#Short circuited stub|l1=stub}}"); #if DEBUG Variables.SetProjectLangCode("ar"); Variables.Stub = @"[^{}|]*?([Ss]tub|بذرة|بذور)"; WikiRegexes.MakeLangSpecificRegexes(); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{بذرة}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{stub}}"); Variables.SetProject("en", ProjectEnum.wikipedia); Variables.Stub = "[^{}|]*?[Ss]tub"; WikiRegexes.MakeLangSpecificRegexes(); #endif }
public void ImageTestsGallery() { RegexAssert.IsMatch(WikiRegexes.Images, @"<gallery> Test.JPG Foo.JPEG </gallery>"); RegexAssert.IsMatch(WikiRegexes.Images, @"<Gallery> Test.JPG Foo.JPEG </Gallery>"); RegexAssert.IsMatch(WikiRegexes.Images, @"<Gallery foo=bar> Test.JPG Foo.JPEG </Gallery>"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Gallery |title=Lamu images |width=150 |lines=2 |Image:LamuFort.jpg|Lamu Fort |Image:LAMU Riyadha Mosque.jpg|Riyadha Mosque |Image:04 Donkey Hospital (June 30 2001).jpg|Donkey Sanctuary }}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{ gallery |title=Lamu images |width=150 |lines=2 |Image:LamuFort.jpg|Lamu Fort |Image:LAMU Riyadha Mosque.jpg|Riyadha Mosque |Image:04 Donkey Hospital (June 30 2001).jpg|Donkey Sanctuary }}"); }
public void DefaultsortTests() { RegexAssert.IsMatch(WikiRegexes.Defaultsort, "{{DEFAULTSORT:foo}}"); RegexAssert.IsMatch(WikiRegexes.Defaultsort, "{{DEFAULTSORT:foo bar}}"); RegexAssert.IsMatch(WikiRegexes.Defaultsort, @"{{DEFAULTSORT:foo "); RegexAssert.NoMatch(WikiRegexes.Defaultsort, @"{{DEFAULTSORT:foo"); Assert.AreEqual("foo", WikiRegexes.Defaultsort.Match(@"{{DEFAULTSORT:foo}}").Groups["key"].Value); Assert.AreEqual(@"{{PAGENAME}}", WikiRegexes.Defaultsort.Match(@"{{DEFAULTSORT:{{PAGENAME}}}}").Groups["key"].Value); Assert.AreEqual("{{DEFAULTSORT:foo}}", WikiRegexes.Defaultsort.Match(@"{{DEFAULTSORT:foo}}").Value); Assert.AreEqual("{{DEFAULTSORT:foo\r", WikiRegexes.Defaultsort.Match(@"{{DEFAULTSORT:foo now").Value); Assert.AreEqual(@"{{DEFAULTSORT:{{PAGENAME}}}}", WikiRegexes.Defaultsort.Match(@"{{DEFAULTSORT:{{PAGENAME}}}}").Value); Assert.AreEqual(@"{{DEFAULTSORT:foo]]" + "\r", WikiRegexes.Defaultsort.Match(@"{{DEFAULTSORT:foo]] pp").Value); Assert.AreEqual(@"{{DEFAULTSORT:foo]]" + "\r", WikiRegexes.Defaultsort.Match(@"{{DEFAULTSORT:foo]] pp {{x}} ").Value); }
private void AssertAllHidden(string text) { string s = Hide(text); RegexAssert.IsMatch(allHidden, s); s = hider.AddBackMore(s); Assert.AreEqual(text, s); }
public void CategoryTests() { RegexAssert.IsMatch(WikiRegexes.Category, "[[Category:Test]]"); RegexAssert.IsMatch(WikiRegexes.Category, "[[Category:Test|Key]]"); RegexAssert.NoMatch(WikiRegexes.Category, "[[Test]]"); RegexAssert.NoMatch(WikiRegexes.Category, "[[Image:Test.jpg]]"); }
private void AssertAllHiddenMore(string text, bool HideExternalLinks) { string s = HideMore(text, HideExternalLinks, false, true); RegexAssert.IsMatch(allHidden, s); s = hider.AddBackMore(s); Assert.AreEqual(text, s); }
/// public void PossibleInterwikis() { RegexAssert.Matches(WikiRegexes.PossibleInterwikis, "foo[[en:bar]]", "[[en:bar]]"); RegexAssert.Matches(WikiRegexes.PossibleInterwikis, "[[en:bar]][[ru:", "[[en:bar]]"); RegexAssert.Matches(WikiRegexes.PossibleInterwikis, "foo[[en:bar:quux]][[ru:boz test]]", "[[en:bar:quux]]", "[[ru:boz test]]"); RegexAssert.NoMatch(WikiRegexes.PossibleInterwikis, "[[:en:foo]]"); RegexAssert.NoMatch(WikiRegexes.PossibleInterwikis, "[[:foo]]"); }
public void ImageTestsInfoboxes() { RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| image = [[File:Test.JPG]] | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| image2 = [[File:Test.JPG]] | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| img = [[File:Test.JPG]] | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| img = Test.JPEG | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| cover = [[Image:Test.JPG]] | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| cover art = Test2.png | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| cover_ar = Test.JPG | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a|map=[[File:Test.JPG]] | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| map = [[File:Test.JPG]] | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| strangename = Test.JPEG | there=here}}"); RegexAssert.IsMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| picture = Test.JPG | there=here}}"); RegexAssert.NoMatch(WikiRegexes.Images, @"{{Infobox foo| bar = a| map = Image without exension | there=here}}"); RegexAssert.Matches(WikiRegexes.Images, @"{{Infobox foo| bar = a| picture = Test.JPG | there=here}}", @" Test.JPG"); }
public void AmericanDates() { RegexAssert.IsMatch(WikiRegexes.AmericanDates, @"On July 11, 2009 a"); RegexAssert.IsMatch(WikiRegexes.AmericanDates, @"On July 11 2009 a"); RegexAssert.IsMatch(WikiRegexes.AmericanDates, @"On July 11, 1809 a"); RegexAssert.NoMatch(WikiRegexes.AmericanDates, @"On July 11, 29 a"); RegexAssert.NoMatch(WikiRegexes.AmericanDates, @"On 11 July 2009"); }
public void InternationalDates() { RegexAssert.IsMatch(WikiRegexes.InternationalDates, @"On 11 July 2009"); RegexAssert.IsMatch(WikiRegexes.InternationalDates, @"On 11 July 2009"); RegexAssert.IsMatch(WikiRegexes.InternationalDates, @"On 1 July 1809"); RegexAssert.NoMatch(WikiRegexes.InternationalDates, @"On 11 July 44"); RegexAssert.NoMatch(WikiRegexes.InternationalDates, @"On July 11, 2009 a"); }
public void BulletedText() { RegexAssert.NoMatch(WikiRegexes.BulletedText, ""); RegexAssert.Matches(WikiRegexes.BulletedText, ":foo", ":foo"); RegexAssert.Matches(WikiRegexes.BulletedText, ":foo\r\n", ":foo\r"); RegexAssert.Matches(WikiRegexes.BulletedText, "#foo\r\n*:bar", "#foo\r", "*:bar"); RegexAssert.Matches(WikiRegexes.BulletedText, "#foo\r\ntest\r\n*:bar", "#foo\r", "*:bar"); RegexAssert.Matches(WikiRegexes.BulletedText, " foo\r\nfoo bar", " foo\r"); }
public void WiTests() { RegexAssert.IsMatch(WikiRegexes.Wi, @"{{Wiktionary redirect}}"); RegexAssert.IsMatch(WikiRegexes.Wi, @"{{wiktionary redirect}}"); RegexAssert.IsMatch(WikiRegexes.Wi, @"{{wi}}"); RegexAssert.IsMatch(WikiRegexes.Wi, @"{{Wi}}"); RegexAssert.IsMatch(WikiRegexes.Wi, @"{{Moved to Wiktionary}}"); RegexAssert.IsMatch(WikiRegexes.Wi, @"{{RedirecttoWiktionary}}"); RegexAssert.IsMatch(WikiRegexes.Wi, @"{{Seewiktionary}}"); }
public void EmptyLinkTests() { RegexAssert.IsMatch(WikiRegexes.EmptyLink, "[[]]"); RegexAssert.IsMatch(WikiRegexes.EmptyLink, "[[ ]]"); RegexAssert.IsMatch(WikiRegexes.EmptyLink, "[[|]]"); RegexAssert.IsMatch(WikiRegexes.EmptyLink, "[[ | ]]"); RegexAssert.IsMatch(WikiRegexes.EmptyLink, "[[Category:]]"); RegexAssert.IsMatch(WikiRegexes.EmptyLink, "[[Image:]]"); RegexAssert.IsMatch(WikiRegexes.EmptyLink, "[[File:]]"); }
public void MonthDay() { RegexAssert.IsMatch(WikiRegexes.MonthDay, @"On July 11, 2009 a"); RegexAssert.IsMatch(WikiRegexes.MonthDay, @"On July 11 a"); RegexAssert.IsMatch(WikiRegexes.MonthDay, @"On July 11–12 a"); RegexAssert.IsMatch(WikiRegexes.MonthDay, @"On July 11, 1809 a"); RegexAssert.NoMatch(WikiRegexes.MonthDay, @"In July 07, a"); RegexAssert.NoMatch(WikiRegexes.MonthDay, @"In July 2007, a"); }
public void Template() { RegexAssert.Matches("{{foo}}", WikiRegexes.TemplateMultiLine, "{{foo}}"); RegexAssert.Matches("{{foo}}", WikiRegexes.TemplateMultiLine, "123{{foo}}test"); RegexAssert.Matches("{{foo|bar}}", WikiRegexes.TemplateMultiLine, "{{foo|bar}}"); RegexAssert.Matches("{{foo\r\n|bar=test}}", WikiRegexes.TemplateMultiLine, "{{foo\r\n|bar=test}}"); RegexAssert.Matches("Should match distinct templates", WikiRegexes.TemplateMultiLine, "{{foo}}{{bar}}", "{{foo}}", "{{bar}}"); RegexAssert.Matches("{{foo| {bar} }}", WikiRegexes.TemplateMultiLine, "{{foo| {bar} }}"); }
public void DayMonth() { RegexAssert.IsMatch(WikiRegexes.DayMonth, @"On 11 July, 2009 a"); RegexAssert.IsMatch(WikiRegexes.DayMonth, @"On 11 July 2009 a"); RegexAssert.IsMatch(WikiRegexes.DayMonth, @"On 11 July a"); RegexAssert.IsMatch(WikiRegexes.DayMonth, @"On 11–12 July a"); RegexAssert.IsMatch(WikiRegexes.DayMonth, @"On 11 July, 1809 a"); RegexAssert.NoMatch(WikiRegexes.DayMonth, @"In 07 July, a"); RegexAssert.NoMatch(WikiRegexes.DayMonth, @"In July 27, a"); }
public void SIAsTests() { RegexAssert.IsMatch(WikiRegexes.SIAs, @"{{surname}}"); RegexAssert.IsMatch(WikiRegexes.SIAs, @"{{given name}}"); RegexAssert.IsMatch(WikiRegexes.SIAs, @"{{Shipindex}}"); RegexAssert.IsMatch(WikiRegexes.SIAs, @"{{mountainindex}}"); RegexAssert.IsMatch(WikiRegexes.SIAs, @"{{Roadindex}}"); RegexAssert.IsMatch(WikiRegexes.SIAs, @"{{SIA}}"); RegexAssert.IsMatch(WikiRegexes.SIAs, @"{{sportindex}}"); RegexAssert.NoMatch(WikiRegexes.SIAs, @"{{surname-stub}}"); }
public void DefaultsortTests() { RegexAssert.IsMatch(WikiRegexes.Defaultsort, "{{DEFAULTSORT:foo}}"); RegexAssert.IsMatch(WikiRegexes.Defaultsort, "{{DEFAULTSORT:foo bar}}"); RegexAssert.IsMatch(WikiRegexes.Defaultsort, @"{{DEFAULTSORT:foo "); Assert.AreEqual("{{DEFAULTSORT:foo}}", WikiRegexes.Defaultsort.Match(@"{{DEFAULTSORT:foo}}").Value); Assert.AreEqual("{{DEFAULTSORT:foo\r", WikiRegexes.Defaultsort.Match(@"{{DEFAULTSORT:foo now").Value); }
public void Template() { RegexAssert.Matches("{{foo}}", WikiRegexes.TemplateMultiLine, "{{foo}}"); RegexAssert.Matches("{{foo}}", WikiRegexes.TemplateMultiLine, "123{{foo}}test"); RegexAssert.Matches("{{foo|bar}}", WikiRegexes.TemplateMultiLine, "{{foo|bar}}"); RegexAssert.Matches("{{foo\r\n|bar=test}}", WikiRegexes.TemplateMultiLine, "{{foo\r\n|bar=test}}"); RegexAssert.Matches("Should match distinct templates", WikiRegexes.TemplateMultiLine, "{{foo}}{{bar}}", "{{foo}}", "{{bar}}"); // regex won't match if nested template or curly-bracketed stuff RegexAssert.NoMatch(WikiRegexes.TemplateMultiLine, "{{foo| {bar} }}"); }
public void StubTests() { RegexAssert.IsMatch(WikiRegexes.Stub, @"{{footballer-bio-stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{ footballer-bio-stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{ Footballer-Bio-Stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{bio-stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{ stub}}"); RegexAssert.IsMatch(WikiRegexes.Stub, @"{{Stub}}"); RegexAssert.NoMatch(WikiRegexes.Stub, @"{{now stubborn}}"); RegexAssert.NoMatch(WikiRegexes.Stub, @"{{stubby}}"); }
public void LooseCategoryTests() { RegexAssert.IsMatch(WikiRegexes.LooseCategory, "[[Category :Test]]"); RegexAssert.IsMatch(WikiRegexes.LooseCategory, "[[ category :Test]]"); RegexAssert.IsMatch(WikiRegexes.LooseCategory, "[[CATEGORY :Test]]"); RegexAssert.IsMatch(WikiRegexes.LooseCategory, "[[ Category: Test]]"); RegexAssert.IsMatch(WikiRegexes.LooseCategory, "[[_Category: Test]]"); RegexAssert.IsMatch(WikiRegexes.LooseCategory, "[[ Category :Test|here]]"); RegexAssert.NoMatch(WikiRegexes.LooseCategory, "[[Test]]"); RegexAssert.NoMatch(WikiRegexes.LooseCategory, "[[Category"); RegexAssert.NoMatch(WikiRegexes.LooseCategory, "[[Image:Test.jpg]]"); }
public void ExtractTitleTests() { RegexAssert.IsMatch(WikiRegexes.ExtractTitle, @"http://en.wikipedia.org/wiki/Foo"); RegexAssert.IsMatch(WikiRegexes.ExtractTitle, @"http://en.wikipedia.org/wiki/Foo_bar"); Assert.AreEqual(WikiRegexes.ExtractTitle.Match(@"http://en.wikipedia.org/wiki/Foo").Groups[1].Value, "Foo"); Assert.AreEqual(WikiRegexes.ExtractTitle.Match(@"http://en.wikipedia.org/w/index.php?title=Foo").Groups[1].Value, "Foo"); Assert.AreEqual(WikiRegexes.ExtractTitle.Match(@"http://en.wikipedia.org/w/index.php/Foo").Groups[1].Value, "Foo"); Assert.AreEqual(WikiRegexes.ExtractTitle.Match(@"http://en.wikipedia.org/w/index.php/Foo bar here").Groups[1].Value, "Foo bar here"); RegexAssert.NoMatch(WikiRegexes.ExtractTitle, @"http://random.org/wiki/Foo"); RegexAssert.NoMatch(WikiRegexes.ExtractTitle, @"http://en.wikipedia.org/wikirandom/Foo"); }
public void TemplateCallTests() { RegexAssert.IsMatch(WikiRegexes.TemplateCall, @"{{now stubborn}}"); RegexAssert.IsMatch(WikiRegexes.TemplateCall, @"{{ now stubborn}}"); RegexAssert.IsMatch(WikiRegexes.TemplateCall, @"{{ now stubborn}}"); RegexAssert.IsMatch(WikiRegexes.TemplateCall, @"{{now stubborn|abc|derf=gh|ijk}}"); RegexAssert.IsMatch(WikiRegexes.TemplateCall, @"{{Template:now stubborn}}"); RegexAssert.NoMatch(WikiRegexes.TemplateCall, "[[Test]]"); RegexAssert.NoMatch(WikiRegexes.TemplateCall, "Test"); RegexAssert.NoMatch(WikiRegexes.TemplateCall, "[[Image:Test.jpg]]"); }
public void Dates2Tests() { RegexAssert.IsMatch(WikiRegexes.Dates2, @"May 1"); RegexAssert.IsMatch(WikiRegexes.Dates2, @"June 1"); RegexAssert.IsMatch(WikiRegexes.Dates2, @"May 01"); RegexAssert.IsMatch(WikiRegexes.Dates2, @"May 11"); RegexAssert.IsMatch(WikiRegexes.Dates2, @"May 31"); RegexAssert.NoMatch(WikiRegexes.Dates2, @"May 33"); RegexAssert.NoMatch(WikiRegexes.Dates2, @"13 May"); RegexAssert.NoMatch(WikiRegexes.Dates2, @"MigMay 3"); RegexAssert.NoMatch(WikiRegexes.Dates2, @"may 3"); }
public void DatesTests() { RegexAssert.IsMatch(WikiRegexes.Dates, @"1 May"); RegexAssert.IsMatch(WikiRegexes.Dates, @"1 June"); RegexAssert.IsMatch(WikiRegexes.Dates, @"01 May"); RegexAssert.IsMatch(WikiRegexes.Dates, @"11 May"); RegexAssert.IsMatch(WikiRegexes.Dates, @"31 May"); RegexAssert.NoMatch(WikiRegexes.Dates, @"33 May"); RegexAssert.NoMatch(WikiRegexes.Dates, @"May 13"); RegexAssert.NoMatch(WikiRegexes.Dates, @"3 Maybe"); RegexAssert.NoMatch(WikiRegexes.Dates, @"3 may"); }
public void DayMonthRangeSpan() { RegexAssert.IsMatch(WikiRegexes.DayMonthRangeSpan, @"On 11–12 July a"); RegexAssert.IsMatch(WikiRegexes.DayMonthRangeSpan, @"On 11–12 July, 2004 a"); RegexAssert.IsMatch(WikiRegexes.DayMonthRangeSpan, @"On 11–12 July a"); RegexAssert.IsMatch(WikiRegexes.DayMonthRangeSpan, @"On 11{{ndash}}12 July a"); RegexAssert.IsMatch(WikiRegexes.DayMonthRangeSpan, @"On 11/12 July a"); RegexAssert.NoMatch(WikiRegexes.DayMonthRangeSpan, @"On 11-12 July a"); RegexAssert.NoMatch(WikiRegexes.DayMonthRangeSpan, @"On 1112 July a"); RegexAssert.NoMatch(WikiRegexes.DayMonthRangeSpan, @"On 11 12 July a"); RegexAssert.NoMatch(WikiRegexes.DayMonthRangeSpan, @"On July 11–12 a"); }
public void HideTemplates() { AssertAllHidden("{{foo}}"); AssertAllHidden("{{foo|}}"); AssertAllHidden("{{foo|bar}}"); RegexAssert.IsMatch("123" + hidden + "123", Hide("123{{foo}}123")); AssertAllHidden("{{foo|{{bar}}}}"); AssertAllHidden("{{foo|{{bar|{{{1|}}}}}}}"); AssertAllHidden("{{foo|\r\nbar= {blah} blah}}"); AssertAllHidden("{{foo|\r\nbar= {blah} {{{1|{{blah}}}}}}}"); RegexAssert.IsMatch(@"\{" + hidden + @"\}", Hide("{{{foo}}}")); }