Sha256: d3486c44f7030ae1a8f01298ff44dc467eecc0e630524892a696a25139630e65

Contents?: true

Size: 1.11 KB

Versions: 2

Compression:

Stored size: 1.11 KB

Contents

$VERBOSE = true
require 'minitest/autorun'

require '../netrc/lib/netrc'

class TestLex < MiniTest::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
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
netrc-0.3 test/test_lex.rb
netrc-0.2 test/test_lex.rb