소스 검색

Added more remote path transformation tests.

Gert Driesen 8 년 전
부모
커밋
f8e1b8029a

+ 62 - 2
src/Renci.SshNet.Tests/Classes/RemotePathDoubleQuoteTransformationTest.cs

@@ -446,7 +446,7 @@ namespace Renci.SshNet.Tests.Classes
         }
 
         [TestMethod]
-        public void ExclamationMark_Embedded()
+        public void ExclamationMark_Embedded_Single()
         {
             const string path = "/var/garbage!/temp";
 
@@ -455,6 +455,16 @@ namespace Renci.SshNet.Tests.Classes
             Assert.AreEqual("\"/var/garbage!/temp\"", actual);
         }
 
+        [TestMethod]
+        public void ExclamationMark_Embedded_Sequence()
+        {
+            const string path = "/var/garbage!!/temp";
+
+            var actual = _transformation.Transform(path);
+
+            Assert.AreEqual("\"/var/garbage!!/temp\"", actual);
+        }
+
         [TestMethod]
         public void ExclamationMark_Leading()
         {
@@ -886,7 +896,7 @@ namespace Renci.SshNet.Tests.Classes
         }
 
         [TestMethod]
-        public void SingleQuote_Embedded()
+        public void SingleQuote_Embedded_Single()
         {
             const string path = "Rain'Storm";
 
@@ -895,6 +905,16 @@ namespace Renci.SshNet.Tests.Classes
             Assert.AreEqual("\"Rain'Storm\"", actual);
         }
 
+        [TestMethod]
+        public void SingleQuote_Embedded_Sequence()
+        {
+            const string path = "Rain''Storm";
+
+            var actual = _transformation.Transform(path);
+
+            Assert.AreEqual("\"Rain''Storm\"", actual);
+        }
+
         [TestMethod]
         public void SingleQuote_Leading()
         {
@@ -925,6 +945,46 @@ namespace Renci.SshNet.Tests.Classes
             Assert.AreEqual("\"Time'\"", actual);
         }
 
+        [TestMethod]
+        public void SingleQuoteAndExclamationMark_Embedded()
+        {
+            const string path = "Rain'!Storm";
+
+            var actual = _transformation.Transform(path);
+
+            Assert.AreEqual("\"Rain'!Storm\"", actual);
+        }
+
+        [TestMethod]
+        public void SingleQuoteAndExclamationMark_Leading()
+        {
+            const string path = "'!Rain";
+
+            var actual = _transformation.Transform(path);
+
+            Assert.AreEqual("\"'!Rain\"", actual);
+        }
+
+        [TestMethod]
+        public void SingleQuoteAndExclamationMark_LeadingAndTrailing()
+        {
+            const string path = "'!Rain'!";
+
+            var actual = _transformation.Transform(path);
+
+            Assert.AreEqual("\"'!Rain'!\"", actual);
+        }
+
+        [TestMethod]
+        public void SingleQuoteAndExclamationMark_Trailing()
+        {
+            const string path = "Rain'!";
+
+            var actual = _transformation.Transform(path);
+
+            Assert.AreEqual("\"Rain'!\"", actual);
+        }
+
         [TestMethod]
         public void Space_Embedded()
         {

+ 62 - 2
src/Renci.SshNet.Tests/Classes/RemotePathShellQuoteTransformationTest.cs

@@ -446,7 +446,7 @@ namespace Renci.SshNet.Tests.Classes
         }
 
         [TestMethod]
-        public void ExclamationMark_Embedded()
+        public void ExclamationMark_Embedded_Single()
         {
             const string path = "/var/garbage!/temp";
 
@@ -455,6 +455,16 @@ namespace Renci.SshNet.Tests.Classes
             Assert.AreEqual("'/var/garbage'\\!'/temp'", actual);
         }
 
+        [TestMethod]
+        public void ExclamationMark_Embedded_Sequence()
+        {
+            const string path = "/var/garbage!!/temp";
+
+            var actual = _transformation.Transform(path);
+
+            Assert.AreEqual("'/var/garbage'\\!\\!'/temp'", actual);
+        }
+
         [TestMethod]
         public void ExclamationMark_Leading()
         {
@@ -886,7 +896,7 @@ namespace Renci.SshNet.Tests.Classes
         }
 
         [TestMethod]
-        public void SingleQuote_Embedded()
+        public void SingleQuote_Embedded_Single()
         {
             const string path = "Rain'Storm";
 
@@ -895,6 +905,16 @@ namespace Renci.SshNet.Tests.Classes
             Assert.AreEqual("'Rain'\"'\"'Storm'", actual);
         }
 
+        [TestMethod]
+        public void SingleQuote_Embedded_Sequence()
+        {
+            const string path = "Rain''Storm";
+
+            var actual = _transformation.Transform(path);
+
+            Assert.AreEqual("'Rain'\"''\"'Storm'", actual);
+        }
+
         [TestMethod]
         public void SingleQuote_Leading()
         {
@@ -925,6 +945,46 @@ namespace Renci.SshNet.Tests.Classes
             Assert.AreEqual("'Time'\"'\"", actual);
         }
 
+        [TestMethod]
+        public void SingleQuoteAndExclamationMark_Embedded()
+        {
+            const string path = "Rain'!Storm";
+
+            var actual = _transformation.Transform(path);
+
+            Assert.AreEqual("'Rain'\"'\"\\!'Storm'", actual);
+        }
+
+        [TestMethod]
+        public void SingleQuoteAndExclamationMark_Leading()
+        {
+            const string path = "'!Rain";
+
+            var actual = _transformation.Transform(path);
+
+            Assert.AreEqual("\"'\"\\!'Rain'", actual);
+        }
+
+        [TestMethod]
+        public void SingleQuoteAndExclamationMark_LeadingAndTrailing()
+        {
+            const string path = "'!Rain'!";
+
+            var actual = _transformation.Transform(path);
+
+            Assert.AreEqual("\"'\"\\!'Rain'\"'\"\\!", actual);
+        }
+
+        [TestMethod]
+        public void SingleQuoteAndExclamationMark_Trailing()
+        {
+            const string path = "Rain'!";
+
+            var actual = _transformation.Transform(path);
+
+            Assert.AreEqual("'Rain'\"'\"\\!", actual);
+        }
+
         [TestMethod]
         public void Space_Embedded()
         {