Update version test

上级 1d649991
......@@ -23,25 +23,25 @@ public void CanGetMinimumCompiledInFeatures()
public void CanRetrieveValidVersionString()
{
// Version string format is:
// Major.Minor.Patch[-previewTag]+{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features)
// Major.Minor.Patch[-previewTag]+libgit2-{libgit2_abbrev_hash}.{LibGit2Sharp_hash} (arch - features)
// Example output:
// "0.25.0-preview.52+871d13a67f.libgit2-15e1193 (x86 - Threads, Https)"
// "0.27.0-preview.0.1896+libgit2-c058aa8.c1ac3ed74487da5fac24cf1e48dc8ea71e917b75 (x64 - Threads, Https, NSec)"
string versionInfo = GlobalSettings.Version.ToString();
// The GlobalSettings.Version returned string should contain :
// version: '0.25.0[-previewTag]' LibGit2Sharp version number.
// git2SharpHash: '871d13a67f' LibGit2Sharp hash.
// git2SharpHash: 'c1ac3ed74487da5fac24cf1e48dc8ea71e917b75' LibGit2Sharp hash.
// arch: 'x86' or 'x64' libgit2 target.
// git2Features: 'Threads, Ssh' libgit2 features compiled with.
string regex = @"^(?<version>\d+\.\d+\.\d+(-[\w\-\.]+)?\+((?<git2SharpHash>[a-f0-9]{10})\.)?libgit2-[a-f0-9]{7}) \((?<arch>\w+) - (?<git2Features>(?:\w*(?:, )*\w+)*)\)$";
string regex = @"^(?<version>\d+\.\d+\.\d+(-[\w\-\.]+)?)\+libgit2-[a-f0-9]{7}\.((?<git2SharpHash>[a-f0-9]{40}))? \((?<arch>\w+) - (?<git2Features>(?:\w*(?:, )*\w+)*)\)$";
Assert.NotNull(versionInfo);
Match regexResult = Regex.Match(versionInfo, regex);
Assert.True(regexResult.Success, "The following version string format is enforced:" +
"Major.Minor.Patch[-previewTag]+{LibGit2Sharp_abbrev_hash}.libgit2-{libgit2_abbrev_hash} (x86|x64 - features). " +
"Major.Minor.Patch[-previewTag]+libgit2-{libgit2_abbrev_hash}.{LibGit2Sharp_hash} (arch - features). " +
"But found \"" + versionInfo + "\" instead.");
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册