Sha256: f1914f21e044d6e2210ce8518a94b9887bc4dfab69f0d00a06b9ca2a1de11d00

Contents?: true

Size: 1.02 KB

Versions: 1

Compression:

Stored size: 1.02 KB

Contents

require File.join(File.expand_path(File.dirname(__FILE__)), 'testutilities')
require File.expand_path(File.join(File.dirname(__FILE__), "../lib/amp"))

class Test19Compatibility < AmpTestCase
  
  def test_string_any?
    assert "hello".any?
  end
  
  def test_string_any_false
    assert_false "".any?
  end
  
  def test_lines
    input = "hello\nthere\n\n mike"
    expected = ["hello\n","there\n","\n"," mike"]
    result = []
    input.lines {|str| result << str}
    assert_equal expected, result
  end
  
  def test_lines_to_enum
    input = "hello\nthere\n\n mike"
    # can't do a kind_of? because ruby1.9 has ::Enumerator and
    # 1.8 uses Enumerable::Enumerator
    classname = input.lines.class.to_s.split("::").last
    assert_equal "Enumerator", classname
  end
  
  def test_ord
    assert_equal "h".ord, 104
  end
  
  def test_ord_long_string
    assert_equal "hello".ord, 104
  end
  
  def test_tap
    value = "hi there"
    in_block = nil
    value.tap {|val| in_block = val}
    assert_equal value, in_block
  end
  
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
amp-0.5.3 test/test_19_compatibility.rb