Class: EditorTests

Inherits:
Object
  • Object
show all
Defined in:
lib/vimamsa/tests.rb

Instance Method Summary collapse

Instance Method Details

#test_create_close_bufObject



88
89
90
91
92
93
94
95
96
97
# File 'lib/vimamsa/tests.rb', line 88

def test_create_close_buf
  ['buf.insert_txt("abcdef")',
   [:buf_new,"\n"],
   'buf.insert_txt("a")',
   'buf.insert_txt("b")',
   'buf.insert_txt("c")',
   'buf.insert_txt("d")',
   ['buf.insert_txt("e")',"abcde\n"],
   [:close_current_buffer, "abcdef\n"]]
end

#test_deleteObject



76
77
78
79
80
81
82
83
84
85
86
# File 'lib/vimamsa/tests.rb', line 76

def test_delete
  [['buf.insert_txt("abcdef")', "abcdef\n"],
   'buf.insert_txt("\n")',
   ['buf.insert_txt("yy")', "abcdef\nyy\n"],
   "buf.jump(START_OF_BUFFER)",
   :delete_char_forward,
   [:delete_char_forward, "cdef\nyy\n"],
   "buf.jump(END_OF_LINE)",
   "buf.delete(BACKWARD_CHAR)",
   ["buf.delete(BACKWARD_CHAR)", "cd\nyy\n"]]
end

#test_writeObject



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/vimamsa/tests.rb', line 63

def test_write
  #[[action to run, expected buffer contents after], ...]
  [['buf.insert_txt("zzzz")', "zzzz\n"],
   # At end of file replace should not change anything
   ['buf.replace_with_char("-")', "zzzz\n"],
   'buf.insert_txt("\n")',
   ['buf.insert_txt("yy")', "zzzz\nyy\n"],
   :e_move_backward_char, :e_move_backward_char,
   ['buf.insert_txt("0")', "zzzz\n0yy\n"],
   "buf.jump(START_OF_BUFFER)",
   ['buf.replace_with_char("1")', "1zzz\n0yy\n"]]
end