| 1 |
# test_modeline_element.rb: Test suites of Edmaru::ModeLineElement |
| 2 |
# based on Test::Unit. |
| 3 |
# |
| 4 |
# Copyright (C) 2007 Takashi Nakamoto |
| 5 |
# |
| 6 |
# This program is free software; you can redistribute it and/or modify |
| 7 |
# it under the terms of the GNU General Public License version 2 as |
| 8 |
# published by the Free Software Foundation. |
| 9 |
# |
| 10 |
# This program is distributed in the hope that it will be useful, but |
| 11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 |
# General Public License for more details. |
| 14 |
# |
| 15 |
# You should have received a copy of the GNU General Public License |
| 16 |
# along with this program; if not, write to the Free Software |
| 17 |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
| 18 |
# 02110-1301 USA. |
| 19 |
# |
| 20 |
require "test/unit" |
| 21 |
require "modeline_element.rb" |
| 22 |
|
| 23 |
module EdmaruTest |
| 24 |
class TC_ModeLineElement < Test::Unit::TestCase |
| 25 |
def setup |
| 26 |
#Nothing to do. |
| 27 |
end |
| 28 |
|
| 29 |
def test_default |
| 30 |
modeline = Edmaru::ModeLineElement.new("test") |
| 31 |
assert_instance_of(Edmaru::ModeLineElement, modeline) |
| 32 |
assert_equal("test", modeline.name) |
| 33 |
assert_equal(0, modeline.actual_width) |
| 34 |
assert_equal("", modeline.text) |
| 35 |
assert_equal("", modeline.surface) |
| 36 |
end |
| 37 |
|
| 38 |
def test_initialize |
| 39 |
modeline = Edmaru::ModeLineElement.new("init", -1, 1, 2, "default") |
| 40 |
assert_instance_of(Edmaru::ModeLineElement, modeline) |
| 41 |
assert_equal("init", modeline.name) |
| 42 |
assert_equal(10, modeline.actual_width) |
| 43 |
assert_equal("default", modeline.text) |
| 44 |
assert_equal(" default ", modeline.surface) |
| 45 |
|
| 46 |
modeline.text = "variable" |
| 47 |
assert_equal(11, modeline.actual_width) |
| 48 |
assert_equal("variable", modeline.text) |
| 49 |
assert_equal(" variable ", modeline.surface) |
| 50 |
end |
| 51 |
|
| 52 |
def test_fixed |
| 53 |
modeline = Edmaru::ModeLineElement.new("fixed", 3, 1, 1, "All") |
| 54 |
assert_instance_of(Edmaru::ModeLineElement, modeline) |
| 55 |
assert_equal("fixed", modeline.name) |
| 56 |
assert_equal(5, modeline.actual_width) |
| 57 |
assert_equal("All", modeline.text) |
| 58 |
assert_equal(" All ", modeline.surface) |
| 59 |
|
| 60 |
modeline.text = "Bottom" |
| 61 |
assert_equal(5, modeline.actual_width) |
| 62 |
assert_equal("Bottom", modeline.text) |
| 63 |
assert_equal(" Bot ", modeline.surface) |
| 64 |
|
| 65 |
modeline.text = "At" |
| 66 |
assert_equal(5, modeline.actual_width) |
| 67 |
assert_equal("At", modeline.text) |
| 68 |
assert_equal(" At ", modeline.surface) |
| 69 |
end |
| 70 |
end |
| 71 |
end |