Skip to content

Commit decdfda

Browse files
committed
Improve tests
1 parent 84add11 commit decdfda

2 files changed

Lines changed: 36 additions & 3 deletions

File tree

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2015-2022 Akinori Hattori <hattya@gmail.com>
1+
Copyright (c) 2015-2023 Akinori Hattori <hattya@gmail.com>
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

test/indent.vimspec

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ Describe filetype indent
173173

174174
It indents like the previous line (triple-quoted string)
175175
let in = "def func():\<CR>"
176-
let in .= "s = '''\\\<CR>0\<C-D>spam\<CR>ham\<CR>eggs\<CR>'''\<CR>"
176+
let in .= "s = '''\\\<CR>0\<C-D>spam\<CR>eggs\<CR>ham\<CR>'''\<CR>"
177177
let in .= "v ="
178178
let out = [
179179
\ 'def func():',
180180
\ " s = '''\\",
181181
\ 'spam',
182-
\ 'ham',
183182
\ 'eggs',
183+
\ 'ham',
184184
\ "'''",
185185
\ ' v =',
186186
\]
@@ -308,6 +308,39 @@ Describe filetype indent
308308
\]
309309
Assert Equals(Insert(in), Buffer(out))
310310
End
311+
312+
It indents by the option value (hanging indent)
313+
let in = "def func(\<CR>*args,\<CR>**kwargs\<CR>):"
314+
let out = [
315+
\ 'def func(',
316+
\ ' *args,',
317+
\ ' **kwargs',
318+
\ '):',
319+
\]
320+
Assert Equals(Insert(in), Buffer(out))
321+
End
322+
323+
It decreases the indent level after pass
324+
let in = "def spam():\<CR>pass\<CR>"
325+
let in .= "def eggs():"
326+
let out = [
327+
\ 'def spam():',
328+
\ ' pass',
329+
\ 'def eggs():',
330+
\]
331+
Assert Equals(Insert(in), Buffer(out))
332+
End
333+
334+
It decreases the indent level after return
335+
let in = "def spam():\<CR>return\<CR>"
336+
let in .= "def eggs():"
337+
let out = [
338+
\ 'def spam():',
339+
\ ' return',
340+
\ 'def eggs():',
341+
\]
342+
Assert Equals(Insert(in), Buffer(out))
343+
End
311344
End
312345

313346
Describe if statement

0 commit comments

Comments
 (0)