git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[JGIT PATCH] Add test for OpenSshConfig separator parsing

From
Jonas Fonseca <fonseca@diku.dk>
Date
Sep 20, 2008, 22:33 UTC
Message-ID
<20080920223340.GB18981@diku.dk>
In-Reply-To
<20080920214808.GA7426@diku.dk>
Signed-off-by: Jonas Fonseca <fonseca@diku.dk>
---
 .../spearce/jgit/transport/OpenSshConfigTest.java  |   24 ++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)
 I sent the previous patch a bit too early. This one has the assertions.
diff --git a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/OpenSshConfigTest.java b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/OpenSshConfigTest.java
index 959b6b7..8c1133d 100644
--- a/org.spearce.jgit.test/tst/org/spearce/jgit/transport/OpenSshConfigTest.java
+++ b/org.spearce.jgit.test/tst/org/spearce/jgit/transport/OpenSshConfigTest.java
@@ -81,6 +81,30 @@ public void testNoConfig() {
 		assertNull(h.getIdentityFile());
 	}
 
+	public void testSeparatorParsing() throws Exception {
+		config("Host\tfirst\n" +
+		       "\tHostName\tfirst.tld\n" +
+		       "\n" +
+		       "Host second\n" +
+		       " HostName\tsecond.tld\n" +
+		       "Host=third\n" +
+		       "HostName=third.tld\n\n\n" +
+		       "\t Host = fourth\n\n\n" +
+		       " \t HostName\t=fourth.tld\n" +
+		       "Host\t =     last\n" +
+		       "HostName  \t    last.tld");
+		assertNotNull(osc.lookup("first"));
+		assertEquals("first.tld", osc.lookup("first").getHostName());
+		assertNotNull(osc.lookup("second"));
+		assertEquals("second.tld", osc.lookup("second").getHostName());
+		assertNotNull(osc.lookup("third"));
+		assertEquals("third.tld", osc.lookup("third").getHostName());
+		assertNotNull(osc.lookup("fourth"));
+		assertEquals("fourth.tld", osc.lookup("fourth").getHostName());
+		assertNotNull(osc.lookup("last"));
+		assertEquals("last.tld", osc.lookup("last").getHostName());
+	}
+
 	public void testAlias_DoesNotMatch() throws Exception {
 		config("Host orcz\n" + "\tHostName repo.or.cz\n");
 		final Host h = osc.lookup("repo.or.cz");
-- 
1.6.0.2.444.gf2494

-- 
Jonas Fonseca
Previous: Jonas FonsecaNext: Robin Rosenberg
Message 3 of 16 in “Fixed a bug that caused tabs in ~/.ssh/config to break parsing”
  1. Fixed a bug that caused tabs in ~/.ssh/config to break parsingGilion Goudsmit, Sep 20, 2008
  2. Add test for OpenSshConfig separator parsingJonas Fonseca, Sep 20, 2008
  3. Add test for OpenSshConfig separator parsingJonas Fonseca, Sep 20, 2008
  4. Robin RosenbergSep 20, 2008
  5. Jonas FonsecaSep 20, 2008
  6. Test and fix handling of quotes in ~/.ssh/configJonas Fonseca, Sep 21, 2008
  7. Robin RosenbergSep 22, 2008
  8. Shawn O. PearceSep 22, 2008
  9. Jonas FonsecaSep 24, 2008
  10. Shawn O. PearceSep 24, 2008
  11. Add tests for handling of parsing errors in OpenSshConfigJonas Fonseca, Sep 25, 2008
  12. Robin RosenbergSep 25, 2008
  13. Improve handling of parsing errors in OpenSshConfigJonas Fonseca, Sep 25, 2008
  14. Jonas FonsecaSep 25, 2008
  15. Shawn O. PearceSep 25, 2008
  16. Robin RosenbergSep 25, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.