net-dns 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.gitignore +1 -1
- data/.rspec +1 -0
- data/.rubocop.yml +3 -0
- data/.rubocop_defaults.yml +364 -0
- data/.rubocop_todo.yml +207 -0
- data/.travis.yml +9 -16
- data/CHANGELOG.md +12 -1
- data/Gemfile +6 -2
- data/LICENSE.txt +56 -0
- data/README.md +94 -77
- data/Rakefile +23 -56
- data/bin/console +14 -0
- data/demo/check_soa.rb +27 -38
- data/demo/threads.rb +3 -7
- data/lib/net/dns.rb +4 -11
- data/lib/net/dns/core_ext.rb +8 -15
- data/lib/net/dns/header.rb +58 -66
- data/lib/net/dns/names.rb +25 -23
- data/lib/net/dns/packet.rb +136 -139
- data/lib/net/dns/question.rb +36 -39
- data/lib/net/dns/resolver.rb +103 -113
- data/lib/net/dns/resolver/socks.rb +45 -51
- data/lib/net/dns/resolver/timeouts.rb +17 -26
- data/lib/net/dns/rr.rb +107 -117
- data/lib/net/dns/rr/a.rb +46 -55
- data/lib/net/dns/rr/aaaa.rb +40 -49
- data/lib/net/dns/rr/classes.rb +26 -29
- data/lib/net/dns/rr/cname.rb +33 -41
- data/lib/net/dns/rr/hinfo.rb +44 -56
- data/lib/net/dns/rr/mr.rb +33 -42
- data/lib/net/dns/rr/mx.rb +37 -47
- data/lib/net/dns/rr/ns.rb +33 -41
- data/lib/net/dns/rr/null.rb +8 -11
- data/lib/net/dns/rr/ptr.rb +14 -20
- data/lib/net/dns/rr/soa.rb +27 -30
- data/lib/net/dns/rr/srv.rb +13 -17
- data/lib/net/dns/rr/txt.rb +8 -11
- data/lib/net/dns/rr/types.rb +97 -99
- data/lib/net/dns/version.rb +5 -13
- data/net-dns.gemspec +17 -29
- data/{fixtures → spec/fixtures}/resolv.conf +0 -0
- data/spec/spec_helper.rb +14 -0
- data/spec/unit/resolver/dns_timeout_spec.rb +36 -0
- data/spec/unit/resolver/tcp_timeout_spec.rb +46 -0
- data/spec/unit/resolver/udp_timeout_spec.rb +46 -0
- data/test/test_helper.rb +12 -3
- data/test/{header_test.rb → unit/header_test.rb} +43 -46
- data/test/{names_test.rb → unit/names_test.rb} +1 -1
- data/test/{packet_test.rb → unit/packet_test.rb} +3 -5
- data/test/{question_test.rb → unit/question_test.rb} +3 -5
- data/test/{resolver_test.rb → unit/resolver_test.rb} +10 -13
- data/test/{rr → unit/rr}/a_test.rb +10 -17
- data/test/{rr → unit/rr}/aaaa_test.rb +7 -14
- data/test/{rr → unit/rr}/classes_test.rb +14 -16
- data/test/{rr → unit/rr}/cname_test.rb +7 -14
- data/test/{rr → unit/rr}/hinfo_test.rb +16 -22
- data/test/{rr → unit/rr}/mr_test.rb +12 -18
- data/test/{rr → unit/rr}/mx_test.rb +18 -24
- data/test/{rr → unit/rr}/ns_test.rb +10 -16
- data/test/{rr → unit/rr}/types_test.rb +10 -8
- data/test/{rr_test.rb → unit/rr_test.rb} +33 -37
- metadata +77 -49
- data/test/resolver/timeouts_test.rb +0 -109
@@ -1,11 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'net/dns/rr'
|
3
3
|
|
4
|
-
class RRMRTest < Test
|
5
|
-
|
4
|
+
class RRMRTest < Minitest::Test
|
6
5
|
def setup
|
7
6
|
@klass = Net::DNS::RR::MR
|
8
|
-
@rr = @klass.new(:
|
7
|
+
@rr = @klass.new(name: "eddie.movie.edu.", newname: "eddie.bornagain.edu.", ttl: 9000)
|
9
8
|
|
10
9
|
@rr_name = "eddie.movie.edu."
|
11
10
|
@rr_type = "MR"
|
@@ -16,9 +15,8 @@ class RRMRTest < Test::Unit::TestCase
|
|
16
15
|
@rr_output = "eddie.movie.edu. 9000 IN MR eddie.bornagain.edu."
|
17
16
|
end
|
18
17
|
|
19
|
-
|
20
18
|
def test_initialize_from_hash
|
21
|
-
@record = @klass.new(:
|
19
|
+
@record = @klass.new(name: "eddie.movie.edu.", newname: "eddie.bornagain.edu.", ttl: 9000)
|
22
20
|
assert_equal @rr_output, @record.inspect
|
23
21
|
assert_equal @rr_name, @record.name
|
24
22
|
assert_equal @rr_type, @record.type
|
@@ -48,7 +46,6 @@ class RRMRTest < Test::Unit::TestCase
|
|
48
46
|
# assert_equal @rr_newname, @record.newname
|
49
47
|
# end
|
50
48
|
|
51
|
-
|
52
49
|
InvalidArguments = [
|
53
50
|
# FIXME: { :name => "eddie.movie.edu.", :newname => "foo___bar" },
|
54
51
|
# FIXME: { :name => "eddie.movie.edu.", :newname => "foo$bar" },
|
@@ -56,7 +53,7 @@ class RRMRTest < Test::Unit::TestCase
|
|
56
53
|
Object.new,
|
57
54
|
Array.new(7),
|
58
55
|
"9000 IN MR",
|
59
|
-
]
|
56
|
+
].freeze
|
60
57
|
|
61
58
|
InvalidArguments.each_with_index do |arguments, index|
|
62
59
|
define_method "test_initialize_should_raise_with_invalid_arguments_#{index}" do
|
@@ -65,28 +62,26 @@ class RRMRTest < Test::Unit::TestCase
|
|
65
62
|
end
|
66
63
|
|
67
64
|
def test_initialize_should_raise_with_missing_newname
|
68
|
-
error = assert_raises(ArgumentError) { @klass.new(:
|
65
|
+
error = assert_raises(ArgumentError) { @klass.new(name: "eddie.movie.edu.") }
|
69
66
|
assert_match /:newname/, error.message
|
70
67
|
end
|
71
68
|
|
72
|
-
|
73
69
|
def test_value
|
74
|
-
@rr = @klass.new(:
|
75
|
-
assert_equal
|
70
|
+
@rr = @klass.new(name: "eddie.movie.edu.", newname: "eddie.newname.edu.")
|
71
|
+
assert_equal "eddie.newname.edu.", @rr.value
|
76
72
|
|
77
|
-
@rr = @klass.new(:
|
78
|
-
assert_equal
|
73
|
+
@rr = @klass.new(name: "eddie.movie.edu.", newname: "eddie.othername.edu.")
|
74
|
+
assert_equal "eddie.othername.edu.", @rr.value
|
79
75
|
end
|
80
76
|
|
81
77
|
def test_newname
|
82
|
-
@rr = @klass.new(:
|
83
|
-
assert_equal
|
78
|
+
@rr = @klass.new(name: "eddie.movie.edu.", newname: "eddie.newname.edu.")
|
79
|
+
assert_equal "eddie.newname.edu.", @rr.newname
|
84
80
|
|
85
|
-
@rr = @klass.new(:
|
81
|
+
@rr = @klass.new(name: "eddie.movie.edu.", newname: "eddie.othername.edu.")
|
86
82
|
assert_equal "eddie.othername.edu.", @rr.newname
|
87
83
|
end
|
88
84
|
|
89
|
-
|
90
85
|
def test_inspect
|
91
86
|
assert_equal "eddie.movie.edu. 9000 IN MR eddie.bornagain.edu.",
|
92
87
|
@rr.inspect
|
@@ -101,5 +96,4 @@ class RRMRTest < Test::Unit::TestCase
|
|
101
96
|
assert_equal ["eddie.movie.edu.", 9000, "IN", "MR", "eddie.bornagain.edu."],
|
102
97
|
@rr.to_a
|
103
98
|
end
|
104
|
-
|
105
99
|
end
|
@@ -1,25 +1,23 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'net/dns/rr'
|
3
3
|
|
4
|
-
class RRMXTest < Test
|
5
|
-
|
4
|
+
class RRMXTest < Minitest::Test
|
6
5
|
def setup
|
7
6
|
@rr_name = "example.com."
|
8
7
|
@rr_type = "MX"
|
9
8
|
@rr_cls = "IN"
|
10
|
-
@rr_ttl =
|
9
|
+
@rr_ttl = 10_000
|
11
10
|
@rr_preference = 10
|
12
11
|
@rr_exchange = "mail.example.com."
|
13
12
|
@rr_value = "#{@rr_preference} #{@rr_exchange}"
|
14
13
|
|
15
14
|
@rr_output = "example.com. 10000 IN MX 10 mail.example.com."
|
16
15
|
|
17
|
-
@rr = Net::DNS::RR::MX.new(:
|
16
|
+
@rr = Net::DNS::RR::MX.new(name: "example.com.", preference: 10, exchange: "mail.example.com.", ttl: 10_000)
|
18
17
|
end
|
19
18
|
|
20
|
-
|
21
19
|
def test_initialize_from_hash
|
22
|
-
@record = Net::DNS::RR::MX.new(:
|
20
|
+
@record = Net::DNS::RR::MX.new(name: "example.com.", preference: 10, exchange: "mail.example.com.", ttl: 10_000)
|
23
21
|
assert_equal @rr_output, @record.to_s
|
24
22
|
assert_equal @rr_name, @record.name
|
25
23
|
assert_equal @rr_type, @record.type
|
@@ -53,14 +51,13 @@ class RRMXTest < Test::Unit::TestCase
|
|
53
51
|
# assert_equal @rr_exchange, @record.exchange
|
54
52
|
# end
|
55
53
|
|
56
|
-
|
57
54
|
InvalidArguments = [
|
58
|
-
{ :
|
55
|
+
{ name: "google.com" },
|
59
56
|
Object.new,
|
60
57
|
Array.new(7),
|
61
58
|
"10800 IN NS",
|
62
59
|
"google.com. 10800 IN NS",
|
63
|
-
]
|
60
|
+
].freeze
|
64
61
|
|
65
62
|
InvalidArguments.each_with_index do |arguments, index|
|
66
63
|
define_method "test_initialize_should_raise_with_invalid_arguments_#{index}" do
|
@@ -68,32 +65,30 @@ class RRMXTest < Test::Unit::TestCase
|
|
68
65
|
end
|
69
66
|
end
|
70
67
|
|
71
|
-
|
72
68
|
def test_preference
|
73
|
-
@rr = Net::DNS::RR::MX.new(:
|
74
|
-
assert_equal
|
69
|
+
@rr = Net::DNS::RR::MX.new(name: "example.com.", preference: 10, exchange: "mail.example.com.")
|
70
|
+
assert_equal 10, @rr.preference
|
75
71
|
|
76
|
-
@rr = Net::DNS::RR::MX.new(:
|
77
|
-
assert_equal
|
72
|
+
@rr = Net::DNS::RR::MX.new(name: "example.com.", preference: 100, exchange: "mail.example.com.")
|
73
|
+
assert_equal 100, @rr.preference
|
78
74
|
end
|
79
75
|
|
80
76
|
def test_exchange
|
81
|
-
@rr = Net::DNS::RR::MX.new(:
|
82
|
-
assert_equal
|
77
|
+
@rr = Net::DNS::RR::MX.new(name: "example.com.", preference: 10, exchange: "mail.example.com.")
|
78
|
+
assert_equal "mail.example.com.", @rr.exchange
|
83
79
|
|
84
|
-
@rr = Net::DNS::RR::MX.new(:
|
85
|
-
assert_equal
|
80
|
+
@rr = Net::DNS::RR::MX.new(name: "example.com.", preference: 10, exchange: "mail2.example.com.")
|
81
|
+
assert_equal "mail2.example.com.", @rr.exchange
|
86
82
|
end
|
87
83
|
|
88
84
|
def test_value
|
89
|
-
@rr = Net::DNS::RR::MX.new(:
|
90
|
-
assert_equal
|
85
|
+
@rr = Net::DNS::RR::MX.new(name: "example.com.", preference: 10, exchange: "mail.example.com.")
|
86
|
+
assert_equal "10 mail.example.com.", @rr.value
|
91
87
|
|
92
|
-
@rr = Net::DNS::RR::MX.new(:
|
88
|
+
@rr = Net::DNS::RR::MX.new(name: "example.com.", preference: 100, exchange: "mail2.example.com.")
|
93
89
|
assert_equal "100 mail2.example.com.", @rr.value
|
94
90
|
end
|
95
91
|
|
96
|
-
|
97
92
|
def test_inspect
|
98
93
|
assert_equal "example.com. 10000 IN MX 10 mail.example.com.",
|
99
94
|
@rr.inspect
|
@@ -105,8 +100,7 @@ class RRMXTest < Test::Unit::TestCase
|
|
105
100
|
end
|
106
101
|
|
107
102
|
def test_to_a
|
108
|
-
assert_equal ["example.com.",
|
103
|
+
assert_equal ["example.com.", 10_000, "IN", "MX", "10 mail.example.com."],
|
109
104
|
@rr.to_a
|
110
105
|
end
|
111
|
-
|
112
106
|
end
|
@@ -1,23 +1,21 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'net/dns/rr'
|
3
3
|
|
4
|
-
class RRNSTest < Test
|
5
|
-
|
4
|
+
class RRNSTest < Minitest::Test
|
6
5
|
def setup
|
7
6
|
@rr_name = "google.com."
|
8
7
|
@rr_type = "NS"
|
9
8
|
@rr_cls = "IN"
|
10
|
-
@rr_ttl =
|
9
|
+
@rr_ttl = 10_800
|
11
10
|
@rr_nsdname = "ns1.google.com."
|
12
|
-
|
11
|
+
|
13
12
|
@rr_output = "google.com. 10800 IN NS ns1.google.com."
|
14
13
|
|
15
|
-
@rr = Net::DNS::RR::NS.new(:
|
14
|
+
@rr = Net::DNS::RR::NS.new(name: "google.com.", nsdname: "ns1.google.com.", ttl: @rr_ttl)
|
16
15
|
end
|
17
16
|
|
18
|
-
|
19
17
|
def test_initialize_from_hash
|
20
|
-
@record = Net::DNS::RR::NS.new(:
|
18
|
+
@record = Net::DNS::RR::NS.new(name: "google.com.", nsdname: "ns1.google.com.")
|
21
19
|
assert_equal @rr_output, @record.inspect
|
22
20
|
assert_equal @rr_name, @record.name
|
23
21
|
assert_equal @rr_type, @record.type
|
@@ -47,27 +45,24 @@ class RRNSTest < Test::Unit::TestCase
|
|
47
45
|
assert_equal @rr_nsdname, @record.nsdname
|
48
46
|
end
|
49
47
|
|
50
|
-
|
51
48
|
InvalidArguments = [
|
52
|
-
{ :
|
53
|
-
{ :
|
49
|
+
{ name: "google.com", nsdname: "255.256" },
|
50
|
+
{ name: "google.com" },
|
54
51
|
Object.new,
|
55
52
|
Array.new(7),
|
56
53
|
"10800 IN A",
|
57
|
-
]
|
58
|
-
|
54
|
+
].freeze
|
55
|
+
|
59
56
|
InvalidArguments.each_with_index do |arguments, index|
|
60
57
|
define_method "test_initialize_should_raise_with_invalid_arguments_#{index}" do
|
61
58
|
assert_raises(ArgumentError) { Net::DNS::RR::NS.new(arguments) }
|
62
59
|
end
|
63
60
|
end
|
64
61
|
|
65
|
-
|
66
62
|
def test_value
|
67
63
|
assert_equal "ns1.google.com.", @rr.value
|
68
64
|
end
|
69
65
|
|
70
|
-
|
71
66
|
def test_inspect
|
72
67
|
assert_equal "google.com. 10800 IN NS ns1.google.com.",
|
73
68
|
@rr.inspect
|
@@ -79,8 +74,7 @@ class RRNSTest < Test::Unit::TestCase
|
|
79
74
|
end
|
80
75
|
|
81
76
|
def test_to_a
|
82
|
-
assert_equal ["google.com.",
|
77
|
+
assert_equal ["google.com.", 10_800, "IN", "NS", "ns1.google.com."],
|
83
78
|
@rr.to_a
|
84
79
|
end
|
85
|
-
|
86
80
|
end
|
@@ -1,17 +1,18 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'net/dns/rr'
|
3
3
|
|
4
|
-
class RRTypesTest < Test
|
5
|
-
|
4
|
+
class RRTypesTest < Minitest::Test
|
6
5
|
def setup
|
7
6
|
end
|
8
|
-
|
7
|
+
|
9
8
|
def test_default
|
9
|
+
@_default = Net::DNS::RR::Types.default
|
10
|
+
|
10
11
|
# Default type should be ANY => 255
|
11
12
|
instance = Net::DNS::RR::Types.new(nil)
|
12
13
|
assert_equal("1", instance.to_str)
|
13
14
|
assert_equal("A", instance.to_s)
|
14
|
-
|
15
|
+
|
15
16
|
# Let's change default behaviour
|
16
17
|
Net::DNS::RR::Types.default = "A"
|
17
18
|
instance = Net::DNS::RR::Types.new(nil)
|
@@ -22,6 +23,8 @@ class RRTypesTest < Test::Unit::TestCase
|
|
22
23
|
instance = Net::DNS::RR::Types.new(nil)
|
23
24
|
assert_equal("255", instance.to_str)
|
24
25
|
assert_equal("ANY", instance.to_s)
|
26
|
+
ensure
|
27
|
+
Net::DNS::RR::Types.default = Net::DNS::RR::Types::TYPES.invert[@_default]
|
25
28
|
end
|
26
29
|
|
27
30
|
def test_types
|
@@ -34,7 +37,7 @@ class RRTypesTest < Test::Unit::TestCase
|
|
34
37
|
assert_equal(num.to_s, instance_from_num.to_str)
|
35
38
|
end
|
36
39
|
assert_raises(ArgumentError) do
|
37
|
-
Net::DNS::RR::Types.new(
|
40
|
+
Net::DNS::RR::Types.new({})
|
38
41
|
end
|
39
42
|
end
|
40
43
|
|
@@ -45,14 +48,14 @@ class RRTypesTest < Test::Unit::TestCase
|
|
45
48
|
assert_match /\|?#{key}\|?/, pattern
|
46
49
|
end
|
47
50
|
end
|
48
|
-
|
51
|
+
|
49
52
|
def test_valid?
|
50
53
|
assert_equal(true, Net::DNS::RR::Types.valid?("A"))
|
51
54
|
assert_equal(true, Net::DNS::RR::Types.valid?(1))
|
52
55
|
assert_equal(false, Net::DNS::RR::Types.valid?("Q"))
|
53
56
|
assert_equal(false, Net::DNS::RR::Types.valid?(256))
|
54
57
|
assert_raises(ArgumentError) do
|
55
|
-
Net::DNS::RR::Types.valid?
|
58
|
+
Net::DNS::RR::Types.valid?({})
|
56
59
|
end
|
57
60
|
end
|
58
61
|
|
@@ -65,5 +68,4 @@ class RRTypesTest < Test::Unit::TestCase
|
|
65
68
|
Net::DNS::RR::Types.to_str("string")
|
66
69
|
end
|
67
70
|
end
|
68
|
-
|
69
71
|
end
|
@@ -1,27 +1,25 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
require 'net/dns/rr'
|
3
3
|
|
4
|
-
class RRTest < Test
|
5
|
-
|
4
|
+
class RRTest < Minitest::Test
|
6
5
|
def setup
|
7
6
|
@rr_name = "example.com."
|
8
7
|
@type = "A"
|
9
8
|
@cls = "IN"
|
10
|
-
@ttl =
|
9
|
+
@ttl = 10_800
|
11
10
|
@rdata = "64.233.187.99"
|
12
11
|
|
13
|
-
@defaults = Net::DNS::RR.new(:
|
14
|
-
:
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
:
|
19
|
-
:
|
20
|
-
:
|
21
|
-
|
22
|
-
|
12
|
+
@defaults = Net::DNS::RR.new(name: @rr_name,
|
13
|
+
rdata: @rdata)
|
14
|
+
|
15
|
+
@a_hash = Net::DNS::RR.new(name: @rr_name,
|
16
|
+
ttl: @ttl,
|
17
|
+
cls: @cls,
|
18
|
+
type: @type,
|
19
|
+
address: @rdata)
|
20
|
+
|
23
21
|
@a_string = Net::DNS::RR::A.new("example.com. 10800 IN A 64.233.187.99")
|
24
|
-
|
22
|
+
|
25
23
|
@str = "example.com. 10800 IN A 64.233.187.99"
|
26
24
|
|
27
25
|
@a = Net::DNS::RR.new("foo.example.com. 86400 A 10.1.2.3")
|
@@ -31,14 +29,14 @@ class RRTest < Test::Unit::TestCase
|
|
31
29
|
|
32
30
|
@a_data = @a.data
|
33
31
|
@a_binary = Net::DNS::RR.parse(@a_data)
|
34
|
-
@mx_data = @mx.data
|
32
|
+
@mx_data = @mx.data
|
35
33
|
@mx_binary = Net::DNS::RR.parse(@mx_data)
|
36
34
|
|
37
|
-
@array = [@rr_name
|
35
|
+
@array = [@rr_name, @ttl, @cls, @type, @rdata]
|
38
36
|
end
|
39
37
|
|
40
38
|
def test_classes
|
41
|
-
assert_instance_of Net::DNS::RR::A, @a
|
39
|
+
assert_instance_of Net::DNS::RR::A, @a
|
42
40
|
assert_instance_of Net::DNS::RR::MX, @mx
|
43
41
|
assert_instance_of Net::DNS::RR::CNAME, @cname
|
44
42
|
assert_instance_of Net::DNS::RR::TXT, @txt
|
@@ -47,12 +45,12 @@ class RRTest < Test::Unit::TestCase
|
|
47
45
|
end
|
48
46
|
|
49
47
|
def test_ttl
|
50
|
-
assert_equal @a.ttl,
|
48
|
+
assert_equal @a.ttl, 86_400
|
51
49
|
assert_equal @mx.ttl, 7200
|
52
|
-
assert_equal @cname.ttl,
|
50
|
+
assert_equal @cname.ttl, 10_800
|
53
51
|
assert_equal @txt.ttl, 3600
|
54
|
-
assert_equal @a_binary.ttl,
|
55
|
-
assert_equal @mx_binary.ttl, 7200
|
52
|
+
assert_equal @a_binary.ttl, 86_400
|
53
|
+
assert_equal @mx_binary.ttl, 7200
|
56
54
|
end
|
57
55
|
|
58
56
|
def test_types
|
@@ -60,17 +58,17 @@ class RRTest < Test::Unit::TestCase
|
|
60
58
|
assert_equal @mx.type, "MX"
|
61
59
|
assert_equal @cname.type, "CNAME"
|
62
60
|
assert_equal @txt.type, "TXT"
|
63
|
-
assert_equal @a_binary.type, "A"
|
64
|
-
assert_equal @mx_binary.type, "MX"
|
61
|
+
assert_equal @a_binary.type, "A"
|
62
|
+
assert_equal @mx_binary.type, "MX"
|
65
63
|
end
|
66
|
-
|
64
|
+
|
67
65
|
def test_cls
|
68
66
|
assert_equal @a.cls, "IN"
|
69
67
|
assert_equal @mx.cls, "IN"
|
70
68
|
assert_equal @cname.cls, "IN"
|
71
69
|
assert_equal @txt.cls, "HS"
|
72
|
-
assert_equal @a_binary.cls, "IN"
|
73
|
-
assert_equal @mx_binary.cls, "IN"
|
70
|
+
assert_equal @a_binary.cls, "IN"
|
71
|
+
assert_equal @mx_binary.cls, "IN"
|
74
72
|
end
|
75
73
|
|
76
74
|
def test_name
|
@@ -78,10 +76,10 @@ class RRTest < Test::Unit::TestCase
|
|
78
76
|
assert_equal @mx.name, "example.com."
|
79
77
|
assert_equal @cname.name, "www.example.com"
|
80
78
|
assert_equal @txt.name, "baz.example.com"
|
81
|
-
assert_equal @a_binary.name, "foo.example.com."
|
82
|
-
assert_equal @mx_binary.name, "example.com."
|
83
|
-
end
|
84
|
-
|
79
|
+
assert_equal @a_binary.name, "foo.example.com."
|
80
|
+
assert_equal @mx_binary.name, "example.com."
|
81
|
+
end
|
82
|
+
|
85
83
|
def test_rdata
|
86
84
|
assert_equal @a.address.to_s, "10.1.2.3"
|
87
85
|
assert_equal @mx.preference, 10
|
@@ -92,15 +90,15 @@ class RRTest < Test::Unit::TestCase
|
|
92
90
|
assert_equal @mx_binary.preference, 10
|
93
91
|
assert_equal @mx_binary.exchange, "mailhost.example.com."
|
94
92
|
end
|
95
|
-
|
93
|
+
|
96
94
|
def test_simple
|
97
|
-
assert_equal @rr_name,
|
95
|
+
assert_equal @rr_name, @defaults.name
|
98
96
|
assert_equal @type, @defaults.type
|
99
97
|
assert_equal @cls, @defaults.cls
|
100
98
|
assert_equal @ttl, @defaults.ttl
|
101
99
|
assert_equal @rdata, @defaults.rdata.to_s
|
102
|
-
|
103
|
-
assert_equal(@str
|
100
|
+
|
101
|
+
assert_equal(@str, @a_hash.inspect)
|
104
102
|
assert_equal(@rr_name, @a_hash.name)
|
105
103
|
assert_equal(@type, @a_hash.type)
|
106
104
|
assert_equal(@cls, @a_hash.cls)
|
@@ -113,7 +111,7 @@ class RRTest < Test::Unit::TestCase
|
|
113
111
|
assert_equal(@cls, @a_string.cls)
|
114
112
|
assert_equal(@ttl, @a_string.ttl)
|
115
113
|
assert_equal(@rdata, @a_string.address.to_s)
|
116
|
-
|
114
|
+
|
117
115
|
assert_equal(@a_data, @a_binary.data)
|
118
116
|
assert_equal(@mx_data, @mx_binary.data)
|
119
117
|
|
@@ -126,6 +124,4 @@ class RRTest < Test::Unit::TestCase
|
|
126
124
|
Net::DNS::RR.new("google.com. 10800 IM A")
|
127
125
|
end
|
128
126
|
end
|
129
|
-
|
130
127
|
end
|
131
|
-
|