Skip to content

Commit f8e1b80

Browse files
committed
Added more remote path transformation tests.
1 parent b0db16b commit f8e1b80

File tree

2 files changed

+124
-4
lines changed

2 files changed

+124
-4
lines changed

src/Renci.SshNet.Tests/Classes/RemotePathDoubleQuoteTransformationTest.cs

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ public void Equals_Trailing()
446446
}
447447

448448
[TestMethod]
449-
public void ExclamationMark_Embedded()
449+
public void ExclamationMark_Embedded_Single()
450450
{
451451
const string path = "/var/garbage!/temp";
452452

@@ -455,6 +455,16 @@ public void ExclamationMark_Embedded()
455455
Assert.AreEqual("\"/var/garbage!/temp\"", actual);
456456
}
457457

458+
[TestMethod]
459+
public void ExclamationMark_Embedded_Sequence()
460+
{
461+
const string path = "/var/garbage!!/temp";
462+
463+
var actual = _transformation.Transform(path);
464+
465+
Assert.AreEqual("\"/var/garbage!!/temp\"", actual);
466+
}
467+
458468
[TestMethod]
459469
public void ExclamationMark_Leading()
460470
{
@@ -886,7 +896,7 @@ public void Semicolon_Trailing()
886896
}
887897

888898
[TestMethod]
889-
public void SingleQuote_Embedded()
899+
public void SingleQuote_Embedded_Single()
890900
{
891901
const string path = "Rain'Storm";
892902

@@ -895,6 +905,16 @@ public void SingleQuote_Embedded()
895905
Assert.AreEqual("\"Rain'Storm\"", actual);
896906
}
897907

908+
[TestMethod]
909+
public void SingleQuote_Embedded_Sequence()
910+
{
911+
const string path = "Rain''Storm";
912+
913+
var actual = _transformation.Transform(path);
914+
915+
Assert.AreEqual("\"Rain''Storm\"", actual);
916+
}
917+
898918
[TestMethod]
899919
public void SingleQuote_Leading()
900920
{
@@ -925,6 +945,46 @@ public void SingleQuote_Trailing()
925945
Assert.AreEqual("\"Time'\"", actual);
926946
}
927947

948+
[TestMethod]
949+
public void SingleQuoteAndExclamationMark_Embedded()
950+
{
951+
const string path = "Rain'!Storm";
952+
953+
var actual = _transformation.Transform(path);
954+
955+
Assert.AreEqual("\"Rain'!Storm\"", actual);
956+
}
957+
958+
[TestMethod]
959+
public void SingleQuoteAndExclamationMark_Leading()
960+
{
961+
const string path = "'!Rain";
962+
963+
var actual = _transformation.Transform(path);
964+
965+
Assert.AreEqual("\"'!Rain\"", actual);
966+
}
967+
968+
[TestMethod]
969+
public void SingleQuoteAndExclamationMark_LeadingAndTrailing()
970+
{
971+
const string path = "'!Rain'!";
972+
973+
var actual = _transformation.Transform(path);
974+
975+
Assert.AreEqual("\"'!Rain'!\"", actual);
976+
}
977+
978+
[TestMethod]
979+
public void SingleQuoteAndExclamationMark_Trailing()
980+
{
981+
const string path = "Rain'!";
982+
983+
var actual = _transformation.Transform(path);
984+
985+
Assert.AreEqual("\"Rain'!\"", actual);
986+
}
987+
928988
[TestMethod]
929989
public void Space_Embedded()
930990
{

src/Renci.SshNet.Tests/Classes/RemotePathShellQuoteTransformationTest.cs

Lines changed: 62 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ public void Equals_Trailing()
446446
}
447447

448448
[TestMethod]
449-
public void ExclamationMark_Embedded()
449+
public void ExclamationMark_Embedded_Single()
450450
{
451451
const string path = "/var/garbage!/temp";
452452

@@ -455,6 +455,16 @@ public void ExclamationMark_Embedded()
455455
Assert.AreEqual("'/var/garbage'\\!'/temp'", actual);
456456
}
457457

458+
[TestMethod]
459+
public void ExclamationMark_Embedded_Sequence()
460+
{
461+
const string path = "/var/garbage!!/temp";
462+
463+
var actual = _transformation.Transform(path);
464+
465+
Assert.AreEqual("'/var/garbage'\\!\\!'/temp'", actual);
466+
}
467+
458468
[TestMethod]
459469
public void ExclamationMark_Leading()
460470
{
@@ -886,7 +896,7 @@ public void Semicolon_Trailing()
886896
}
887897

888898
[TestMethod]
889-
public void SingleQuote_Embedded()
899+
public void SingleQuote_Embedded_Single()
890900
{
891901
const string path = "Rain'Storm";
892902

@@ -895,6 +905,16 @@ public void SingleQuote_Embedded()
895905
Assert.AreEqual("'Rain'\"'\"'Storm'", actual);
896906
}
897907

908+
[TestMethod]
909+
public void SingleQuote_Embedded_Sequence()
910+
{
911+
const string path = "Rain''Storm";
912+
913+
var actual = _transformation.Transform(path);
914+
915+
Assert.AreEqual("'Rain'\"''\"'Storm'", actual);
916+
}
917+
898918
[TestMethod]
899919
public void SingleQuote_Leading()
900920
{
@@ -925,6 +945,46 @@ public void SingleQuote_Trailing()
925945
Assert.AreEqual("'Time'\"'\"", actual);
926946
}
927947

948+
[TestMethod]
949+
public void SingleQuoteAndExclamationMark_Embedded()
950+
{
951+
const string path = "Rain'!Storm";
952+
953+
var actual = _transformation.Transform(path);
954+
955+
Assert.AreEqual("'Rain'\"'\"\\!'Storm'", actual);
956+
}
957+
958+
[TestMethod]
959+
public void SingleQuoteAndExclamationMark_Leading()
960+
{
961+
const string path = "'!Rain";
962+
963+
var actual = _transformation.Transform(path);
964+
965+
Assert.AreEqual("\"'\"\\!'Rain'", actual);
966+
}
967+
968+
[TestMethod]
969+
public void SingleQuoteAndExclamationMark_LeadingAndTrailing()
970+
{
971+
const string path = "'!Rain'!";
972+
973+
var actual = _transformation.Transform(path);
974+
975+
Assert.AreEqual("\"'\"\\!'Rain'\"'\"\\!", actual);
976+
}
977+
978+
[TestMethod]
979+
public void SingleQuoteAndExclamationMark_Trailing()
980+
{
981+
const string path = "Rain'!";
982+
983+
var actual = _transformation.Transform(path);
984+
985+
Assert.AreEqual("'Rain'\"'\"\\!", actual);
986+
}
987+
928988
[TestMethod]
929989
public void Space_Embedded()
930990
{

0 commit comments

Comments
 (0)