diff options
| author | Lee Marlow <lee.marlow@gmail.com> | 2010-04-13 04:34:55 +0800 |
|---|---|---|
| committer | <net-ssh@solutious.com> | 2010-04-21 04:13:53 +0800 |
| commit | a528bc3b46222b2f480da75606e4fd0754673629 (patch) | |
| tree | 26df4d4b6362c51ef4f65415277793e8c26b9237 /test | |
| parent | 54388c2ce032e12e287274815a50235214c88f56 (diff) | |
| download | net-ssh-a528bc3b46222b2f480da75606e4fd0754673629.tar.gz | |
Allow host aliases to be numeric when parsing ssh_config files
A host with a numeric alias would raise an error because it was coerced
into an integer before trying to split it by spaces when trying to
handle multiple hosts.
For example:
Host 1
Hostname my.favoritehost.com
Diffstat (limited to 'test')
| -rw-r--r-- | test/configs/numeric_host | 4 | ||||
| -rw-r--r-- | test/test_config.rb | 7 |
2 files changed, 11 insertions, 0 deletions
diff --git a/test/configs/numeric_host b/test/configs/numeric_host new file mode 100644 index 0000000..cf75e50 --- /dev/null +++ b/test/configs/numeric_host @@ -0,0 +1,4 @@ +Host 1234 + Compression yes + Port 1980 + RekeyLimit 2G diff --git a/test/test_config.rb b/test/test_config.rb index 37e6eba..361c067 100644 --- a/test/test_config.rb +++ b/test/test_config.rb @@ -102,6 +102,13 @@ class TestConfig < Test::Unit::TestCase assert config['compression'] end + def test_load_with_numeric_host + config = Net::SSH::Config.load(config(:numeric_host), "1234") + assert config['compression'] + assert_equal '2G', config['rekeylimit'] + assert_equal 1980, config['port'] + end + private def config(name) |
