|
1 | 1 | require 'spec_helper' |
2 | 2 |
|
3 | 3 | describe "tex" do |
4 | | - let(:filename) { 'test.tex' } |
| 4 | + let(:filename) { 'test.latex' } |
5 | 5 |
|
6 | 6 | before :each do |
7 | 7 | vim.set :expandtab |
8 | 8 | vim.set :shiftwidth, 2 |
9 | 9 | end |
10 | 10 |
|
11 | | - specify "simple blocks" do |
12 | | - set_file_contents <<~EOF |
13 | | - \\begin{center} Hello World \\end{center} |
14 | | - EOF |
15 | | - |
16 | | - split |
17 | | - |
18 | | - assert_file_contents <<~EOF |
19 | | - \\begin{center} |
20 | | - Hello World |
21 | | - \\end{center} |
22 | | - EOF |
23 | | - |
24 | | - vim.search 'begin' |
25 | | - join |
26 | | - |
27 | | - assert_file_contents <<~EOF |
28 | | - \\begin{center} Hello World \\end{center} |
29 | | - EOF |
30 | | - end |
31 | | - |
32 | | - specify "multiline block" do |
33 | | - set_file_contents <<~EOF |
34 | | - \\begin{center} x = y\\\\ y = z \\end{center} |
35 | | - EOF |
36 | | - |
37 | | - split |
38 | | - |
39 | | - assert_file_contents <<~EOF |
40 | | - \\begin{center} |
41 | | - x = y\\\\ |
42 | | - y = z |
43 | | - \\end{center} |
44 | | - EOF |
45 | | - |
46 | | - join |
47 | | - |
48 | | - assert_file_contents <<~EOF |
49 | | - \\begin{center} x = y\\\\ y = z \\end{center} |
50 | | - EOF |
| 11 | + describe "commands" do |
| 12 | + specify "simple commands" do |
| 13 | + set_file_contents <<~EOF |
| 14 | + \\caption{Example figure} |
| 15 | + EOF |
| 16 | + |
| 17 | + vim.search '{' |
| 18 | + split |
| 19 | + |
| 20 | + assert_file_contents <<~EOF |
| 21 | + \\caption{ |
| 22 | + Example figure |
| 23 | + } |
| 24 | + EOF |
| 25 | + |
| 26 | + join |
| 27 | + |
| 28 | + assert_file_contents <<~EOF |
| 29 | + \\caption{Example figure} |
| 30 | + EOF |
| 31 | + end |
| 32 | + |
| 33 | + specify "nested escaped brackets" do |
| 34 | + set_file_contents <<~EOF |
| 35 | + \\caption{Example \\{nested\\} figure} |
| 36 | + EOF |
| 37 | + |
| 38 | + vim.search 'nested' |
| 39 | + split |
| 40 | + |
| 41 | + assert_file_contents <<~EOF |
| 42 | + \\caption{ |
| 43 | + Example \\{nested\\} figure |
| 44 | + } |
| 45 | + EOF |
| 46 | + |
| 47 | + join |
| 48 | + |
| 49 | + assert_file_contents <<~EOF |
| 50 | + \\caption{Example \\{nested\\} figure} |
| 51 | + EOF |
| 52 | + end |
| 53 | + |
| 54 | + specify "with cursor on command" do |
| 55 | + set_file_contents <<~EOF |
| 56 | + \\caption{Example figure} |
| 57 | + EOF |
| 58 | + |
| 59 | + vim.search 'caption' |
| 60 | + split |
| 61 | + |
| 62 | + assert_file_contents <<~EOF |
| 63 | + \\caption{ |
| 64 | + Example figure |
| 65 | + } |
| 66 | + EOF |
| 67 | + |
| 68 | + vim.search 'caption' |
| 69 | + join |
| 70 | + |
| 71 | + assert_file_contents <<~EOF |
| 72 | + \\caption{Example figure} |
| 73 | + EOF |
| 74 | + end |
51 | 75 | end |
52 | 76 |
|
53 | | - specify "block with parameters" do |
54 | | - set_file_contents <<~EOF |
55 | | - \\begin{tabular}[]{cc} row1 \\\\ row2 \\end{tabular} |
56 | | - EOF |
57 | | - |
58 | | - split |
59 | | - |
60 | | - assert_file_contents <<~EOF |
61 | | - \\begin{tabular}[]{cc} |
62 | | - row1 \\\\ |
63 | | - row2 |
64 | | - \\end{tabular} |
65 | | - EOF |
66 | | - |
67 | | - join |
68 | | - |
69 | | - assert_file_contents <<~EOF |
70 | | - \\begin{tabular}[]{cc} row1 \\\\ row2 \\end{tabular} |
71 | | - EOF |
72 | | - end |
73 | | - |
74 | | - specify "itemized blocks" do |
75 | | - set_file_contents <<~EOF |
76 | | - \\begin{enumerate}\\item item1 \\item item2\\end{enumerate} |
77 | | - EOF |
78 | | - |
79 | | - split |
80 | | - |
81 | | - assert_file_contents <<~EOF |
82 | | - \\begin{enumerate} |
83 | | - \\item item1 |
84 | | - \\item item2 |
85 | | - \\end{enumerate} |
86 | | - EOF |
87 | | - |
88 | | - join |
89 | | - |
90 | | - assert_file_contents <<~EOF |
91 | | - \\begin{enumerate} \\item item1 \\item item2 \\end{enumerate} |
92 | | - EOF |
| 77 | + describe "blocks" do |
| 78 | + specify "simple blocks" do |
| 79 | + set_file_contents <<~EOF |
| 80 | + \\begin{center} Hello World \\end{center} |
| 81 | + EOF |
| 82 | + |
| 83 | + split |
| 84 | + |
| 85 | + assert_file_contents <<~EOF |
| 86 | + \\begin{center} |
| 87 | + Hello World |
| 88 | + \\end{center} |
| 89 | + EOF |
| 90 | + |
| 91 | + vim.search 'begin' |
| 92 | + join |
| 93 | + |
| 94 | + assert_file_contents <<~EOF |
| 95 | + \\begin{center} Hello World \\end{center} |
| 96 | + EOF |
| 97 | + end |
| 98 | + |
| 99 | + specify "multiline block" do |
| 100 | + set_file_contents <<~EOF |
| 101 | + \\begin{center} x = y\\\\ y = z \\end{center} |
| 102 | + EOF |
| 103 | + |
| 104 | + split |
| 105 | + |
| 106 | + assert_file_contents <<~EOF |
| 107 | + \\begin{center} |
| 108 | + x = y\\\\ |
| 109 | + y = z |
| 110 | + \\end{center} |
| 111 | + EOF |
| 112 | + |
| 113 | + join |
| 114 | + |
| 115 | + assert_file_contents <<~EOF |
| 116 | + \\begin{center} x = y\\\\ y = z \\end{center} |
| 117 | + EOF |
| 118 | + end |
| 119 | + |
| 120 | + specify "block with parameters" do |
| 121 | + set_file_contents <<~EOF |
| 122 | + \\begin{tabular}[]{cc} row1 \\\\ row2 \\end{tabular} |
| 123 | + EOF |
| 124 | + |
| 125 | + split |
| 126 | + |
| 127 | + assert_file_contents <<~EOF |
| 128 | + \\begin{tabular}[]{cc} |
| 129 | + row1 \\\\ |
| 130 | + row2 |
| 131 | + \\end{tabular} |
| 132 | + EOF |
| 133 | + |
| 134 | + join |
| 135 | + |
| 136 | + assert_file_contents <<~EOF |
| 137 | + \\begin{tabular}[]{cc} row1 \\\\ row2 \\end{tabular} |
| 138 | + EOF |
| 139 | + end |
| 140 | + |
| 141 | + specify "itemized blocks" do |
| 142 | + set_file_contents <<~EOF |
| 143 | + \\begin{enumerate}\\item item1 \\item item2\\end{enumerate} |
| 144 | + EOF |
| 145 | + |
| 146 | + split |
| 147 | + |
| 148 | + assert_file_contents <<~EOF |
| 149 | + \\begin{enumerate} |
| 150 | + \\item item1 |
| 151 | + \\item item2 |
| 152 | + \\end{enumerate} |
| 153 | + EOF |
| 154 | + |
| 155 | + join |
| 156 | + |
| 157 | + assert_file_contents <<~EOF |
| 158 | + \\begin{enumerate} \\item item1 \\item item2 \\end{enumerate} |
| 159 | + EOF |
| 160 | + end |
93 | 161 | end |
94 | 162 | end |
0 commit comments