| Server IP : 68.178.247.200 / Your IP : 216.73.216.14 Web Server : Apache System : Linux p3plzcpnl489463.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64 User : x9dppmxs4rgd ( 8559391) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/thread-self/root/opt/alt/ruby32/share/gems/gems/netrc-0.11.0/test/ |
Upload File : |
$VERBOSE = true
require 'minitest/autorun'
require File.expand_path("#{File.dirname(__FILE__)}/../lib/netrc")
class TestLex < Minitest::Test
def test_lex_empty
t = Netrc.lex([])
assert_equal([], t)
end
def test_lex_comment
t = Netrc.lex(["# foo\n"])
assert_equal(["# foo\n"], t)
end
def test_lex_comment_after_space
t = Netrc.lex([" # foo\n"])
assert_equal([" # foo\n"], t)
end
def test_lex_comment_after_word
t = Netrc.lex(["x # foo\n"])
assert_equal(["x", " # foo\n"], t)
end
def test_lex_comment_with_hash
t = Netrc.lex(["x # foo # bar\n"])
assert_equal(["x", " # foo # bar\n"], t)
end
def test_lex_word
t = Netrc.lex(["x"])
assert_equal(["x"], t)
end
def test_lex_two_lines
t = Netrc.lex(["x\ny\n"])
assert_equal(["x", "\n", "y", "\n"], t)
end
def test_lex_word_and_comment
t = Netrc.lex(["x\n", "# foo\n"])
assert_equal(["x", "\n", "# foo\n"], t)
end
def test_lex_six_words
t = Netrc.lex(["machine m login l password p\n"])
e = ["machine", " ", "m", " ", "login", " ", "l", " ", "password", " ", "p", "\n"]
assert_equal(e, t)
end
def test_lex_complex
t = Netrc.lex(["machine sub.domain.com login email@domain.com password pass\n"])
e = ["machine", " ", "sub.domain.com", " ", "login", " ", "email@domain.com", " ", "password", " ", "pass", "\n"]
assert_equal(e, t)
end
end