Blame view

test/string_test.rb 591 Bytes
b843bae6b   Romain Deveaud   new files + tests
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
  #!/usr/bin/env ruby
  
  require 'test/unit'
  
  require 'string'
  
  class TestString < Test::Unit::TestCase
  
    def test_extract_xml
      s = "four-piece in <a>Indianapolis</a>, <a>Indiana</a> at the Murat Theatre"
      assert_equal(["Indianapolis", "Indiana"],s.extract_xmltags_values('a'))
    end
  
    def test_stopword
      assert_equal(true, "is".is_stopword?)
      assert_equal(true, "seen".is_stopword?)
      assert_equal(false, "totally".is_stopword?)
      assert_equal(false, "Paris".is_stopword?)
    end
  
    def test_strip_xml
      assert_equal("testme", "<test>testme</test>".strip_xml_tags)
    end
  end