Sha256: e53565216b95325ef2f786d87c90045d38964a5f74ddd668ea4aede077b48832

Contents?: true

Size: 1.39 KB

Versions: 23

Compression:

Stored size: 1.39 KB

Contents

$VERBOSE = true
require 'test/unit'

require File.expand_path("#{File.dirname(__FILE__)}/../lib/netrc")

class TestLex < Test::Unit::TestCase
  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

Version data entries

23 entries across 23 versions & 4 rubygems

Version Path
suzuko-0.1.8 vendor/bundle/ruby/2.0.0/gems/netrc-0.10.3/test/test_lex.rb
suzuko-0.1.7 vendor/bundle/ruby/2.0.0/gems/netrc-0.10.3/test/test_lex.rb
mastermind_adeybee-0.1.4 vendor/bundle/ruby/2.2.0/gems/netrc-0.10.3/test/test_lex.rb
mastermind_adeybee-0.1.3 vendor/bundle/ruby/2.2.0/gems/netrc-0.10.3/test/test_lex.rb
mastermind_adeybee-0.1.2 vendor/bundle/ruby/2.2.0/gems/netrc-0.10.3/test/test_lex.rb
mastermind_adeybee-0.1.1 vendor/bundle/ruby/2.2.0/gems/netrc-0.10.3/test/test_lex.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/netrc-0.10.3/test/test_lex.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/netrc-0.10.3/test/test_lex.rb
netrc-0.10.3 test/test_lex.rb
netrc-0.10.2 test/test_lex.rb
netrc-0.10.1 test/test_lex.rb
netrc-0.10.0 test/test_lex.rb
netrc-0.9.0 test/test_lex.rb
netrc-0.8.0 test/test_lex.rb
netrc-0.7.9 test/test_lex.rb
netrc-0.7.8 test/test_lex.rb
netrc-0.7.7 test/test_lex.rb
netrc-0.7.6 test/test_lex.rb
netrc-0.7.5 test/test_lex.rb
netrc-0.7.4 test/test_lex.rb