Tizen 2.1 base
[external/device-mapper.git] / report-generators / test / tc_string_store.rb
1 # Copyright (C) 2010 Red Hat, Inc. All rights reserved.
2 #
3 # This copyrighted material is made available to anyone wishing to use,
4 # modify, copy, or redistribute it subject to the terms and conditions
5 # of the GNU General Public License v.2.
6 #
7 # You should have received a copy of the GNU General Public License
8 # along with this program; if not, write to the Free Software Foundation,
9 # Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
10
11 require 'string-store'
12 require 'test/unit'
13
14 class TestStringStore < Test::Unit::TestCase
15   def setup
16     @ss = StringStore.new(['report-generators/test/strings',
17                            'report-generators/test/strings/more_strings'])
18   end
19
20   def test_lookup
21     assert_equal("Hello, world!\n", @ss.lookup(:test1))
22     assert_equal("one\ntwo\nthree", @ss.lookup(:test2))
23     assert_equal("lorem\n", @ss.lookup(:test3))
24
25     assert_raises(RuntimeError) do
26       @ss.lookup(:unlikely_name)
27     end
28   end
29 end