Skip to content

Commit

Permalink
#89 Add a working WikiSite.MagicWords property.
Browse files Browse the repository at this point in the history
Removed the defunct SiteInfo.MagicWords property.
  • Loading branch information
CXuesong committed Sep 24, 2021
1 parent b769891 commit d793a7d
Show file tree
Hide file tree
Showing 6 changed files with 244 additions and 100 deletions.
24 changes: 24 additions & 0 deletions UnitTestProject1/Tests/ValidationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,29 @@ public void Issue86()
Assert.Equal(new MediaWikiVersion(1, 19, 20), version);
}

/// <summary>
/// [B]Debian package release adds +dfsg to revision number, breaking version parsing.
/// </summary>
[Fact]
public async Task Issue89()
{
var site = await WpEnSiteAsync;
ShallowTrace(site.MagicWords);
Assert.NotEmpty(site.MagicWords);
Assert.True(site.MagicWords.ContainsName("if"));
// Magic word id is case-sensitive.
Assert.False(site.MagicWords.ContainsName("IF"));
Assert.True(site.MagicWords.ContainsAlias("if"));
Assert.True(site.MagicWords.ContainsAlias("IF"));
Assert.True(site.MagicWords.ContainsAlias("ifExpr"));
Assert.True(site.MagicWords.ContainsAlias("__TOC__"));
Assert.True(site.MagicWords.ContainsAlias("__toc__"));
// Case-sensitive magic
Assert.True(site.MagicWords.ContainsAlias("NAMESPACE"));
Assert.False(site.MagicWords.ContainsAlias("namespace"));
// Non-existing magic
Assert.False(site.MagicWords.ContainsAlias("__non_existing_magic__"));
}

}
}
1 change: 1 addition & 0 deletions WikiClientLibrary.sln.DotSettings
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_PREPROCESSOR_REGION/@EntryValue">NO_INDENT</s:String>
<s:Boolean x:Key="/Default/UserDictionary/Words/=interwiki/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Mediawiki/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/UserDictionary/Words/=Pywikibot/@EntryIndexedValue">True</s:Boolean>
Expand Down
29 changes: 28 additions & 1 deletion WikiClientLibrary/Prompts.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions WikiClientLibrary/Prompts.resx
Original file line number Diff line number Diff line change
Expand Up @@ -312,4 +312,13 @@
<data name="ExceptionVersionMalformed" xml:space="preserve">
<value>Malformed MediaWiki version expression.</value>
</data>
<data name="ExceptionEnumFlagConflict2" xml:space="preserve">
<value>Enum flags {0} and {1} cannot be specified at the same time.</value>
</data>
<data name="ExceptionMagicWordNotFound1" xml:space="preserve">
<value>Magic word or alias "{0}" is not found.</value>
</data>
<data name="ExceptionExtensionNotFound1" xml:space="preserve">
<value>Extension "{0}" is not found.</value>
</data>
</root>
Loading

0 comments on commit d793a7d

Please sign in to comment.