Skip to content

Commit

Permalink
Add test for validation of NodeName
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 30, 2015
1 parent 84596f1 commit 36fc3d1
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/unit/test_node_name.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,23 @@ def node_name(host, port, tag)
:tag => tag)
end

class ValidationTest < self
data(:ip_address => "192.168.0.1:2929/droonga",
:host_name => "node29:2929/droonga")
def test_valid(input)
assert_true(Droonga::NodeName.valid?(input))
end

data(:no_host => ":2929/droonga",
:no_port => "192.168.0.1/droonga",
:no_tag => "192.168.0.1:2929",
:blank => "",
:nil => nil)
def test_invalid(input)
assert_false(Droonga::NodeName.valid?(input))
end
end

class ParseTest < self
def parse(string)
Droonga::NodeName.parse(string)
Expand Down

0 comments on commit 36fc3d1

Please sign in to comment.