Skip to content

Commit 2f38b3a

Browse files
committed
basic folding test
1 parent 0a847f0 commit 2f38b3a

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

spec/folding/basic_spec.rb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# frozen_string_literal: true
2+
3+
require 'spec_helper'
4+
5+
RSpec::Matchers.define :fold_lines do |lines|
6+
file = ".fixture.ex"
7+
8+
9+
match do |code|
10+
File.write(file, code)
11+
VIM.edit file
12+
VIM.command("set foldmethod=syntax")
13+
14+
VIM.normal("zO")
15+
VIM.normal("zM")
16+
VIM.normal("dd")
17+
VIM.write
18+
19+
written = IO.read(file)
20+
code.lines.count - written.lines.count == lines
21+
end
22+
end
23+
24+
describe 'Basic folding' do
25+
it 'blah' do
26+
content = <<~EOF
27+
defmodule M do
28+
end
29+
EOF
30+
31+
expect(content).to fold_lines(2)
32+
end
33+
end
34+

0 commit comments

Comments
 (0)