ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [01/34] ignite git commit: IGNITE-3970 .NET: Fix Cyrillic 'C' letters in code - add test
Date Mon, 10 Oct 2016 16:00:28 GMT
Repository: ignite
Updated Branches:
  refs/heads/ignite-comm-opts2 35ea9ea8e -> a85f2ea42


IGNITE-3970 .NET: Fix Cyrillic 'C' letters in code - add test


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/d643dcf2
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/d643dcf2
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/d643dcf2

Branch: refs/heads/ignite-comm-opts2
Commit: d643dcf2dd2caac4c3ff04cb72f31bbfbf97339a
Parents: daf974d
Author: Pavel Tupitsyn <ptupitsyn@apache.org>
Authored: Wed Sep 28 14:34:23 2016 +0300
Committer: Pavel Tupitsyn <ptupitsyn@apache.org>
Committed: Wed Sep 28 14:34:23 2016 +0300

----------------------------------------------------------------------
 .../ProjectFilesTest.cs                         | 37 +++++++++++++-------
 1 file changed, 24 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/d643dcf2/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProjectFilesTest.cs
----------------------------------------------------------------------
diff --git a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProjectFilesTest.cs b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProjectFilesTest.cs
index 75167b5..a030bf2 100644
--- a/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProjectFilesTest.cs
+++ b/modules/platforms/dotnet/Apache.Ignite.Core.Tests/ProjectFilesTest.cs
@@ -18,6 +18,7 @@
 namespace Apache.Ignite.Core.Tests
 {
     using System;
+    using System.Collections.Generic;
     using System.IO;
     using System.Linq;
     using System.Reflection;
@@ -37,11 +38,7 @@ namespace Apache.Ignite.Core.Tests
             var projFiles = GetDotNetSourceDir().GetFiles("*.csproj", SearchOption.AllDirectories);
             Assert.GreaterOrEqual(projFiles.Length, 7);
 
-            var invalidFiles =
-                projFiles.Where(x => !File.ReadAllText(x.FullName).Contains("ToolsVersion=\"4.0\"")).ToArray();
-
-            Assert.AreEqual(0, invalidFiles.Length,
-                "Invalid csproj files: " + string.Join(", ", invalidFiles.Select(x =>
x.FullName)));
+            CheckFiles(projFiles, x => !x.Contains("ToolsVersion=\"4.0\""), "Invalid csproj
files: ");
         }
 
         /// <summary>
@@ -53,17 +50,31 @@ namespace Apache.Ignite.Core.Tests
             var slnFiles = GetDotNetSourceDir().GetFiles("*.sln", SearchOption.AllDirectories);
             Assert.GreaterOrEqual(slnFiles.Length, 2);
 
-            var invalidFiles =
-                slnFiles.Where(x =>
-                {
-                    var text = File.ReadAllText(x.FullName);
+            CheckFiles(slnFiles, x => !x.Contains("# Visual Studio 2010") ||
+                                      !x.Contains("Microsoft Visual Studio Solution File,
Format Version 11.00"),
+                "Invalid sln files: ");
+        }
 
-                    return !text.Contains("# Visual Studio 2010") ||
-                           !text.Contains("Microsoft Visual Studio Solution File, Format
Version 11.00");
-                }).ToArray();
+        /// <summary>
+        /// Tests that there are no Cyrillic C instead of English C (which are on the same
keyboard key).
+        /// </summary>
+        [Test]
+        public void TestCyrillicChars()
+        {
+            var srcFiles = GetDotNetSourceDir().GetFiles("*.cs", SearchOption.AllDirectories);
+
+            CheckFiles(srcFiles, x => x.Contains('\u0441') || x.Contains('\u0421'), "Files
with Cyrillic 'C': ");
+        }
+
+        /// <summary>
+        /// Checks the files.
+        /// </summary>
+        private static void CheckFiles(IEnumerable<FileInfo> files, Func<string,
bool> isInvalid, string errorText)
+        {
+            var invalidFiles = files.Where(x => isInvalid(File.ReadAllText(x.FullName))).ToArray();
 
             Assert.AreEqual(0, invalidFiles.Length,
-                "Invalid sln files: " + string.Join(", ", invalidFiles.Select(x => x.FullName)));
+                errorText + string.Join(", ", invalidFiles.Select(x => x.FullName)));
         }
 
         /// <summary>


Mime
View raw message