@@ -1139,6 +1139,75 @@ Describe filetype indent
11391139 Assert Equals(Insert(in), Buffer(out))
11401140 End
11411141 End
1142+
1143+ Describe async for statement
1144+ It aligns with left brackets
1145+ let in = "async for _ in (True,\<CR>False):"
1146+ let out = [
1147+ \ 'async for _ in (True,',
1148+ \ ' False):',
1149+ \]
1150+ Assert Equals(Insert(in), Buffer(out))
1151+ End
1152+
1153+ It increases the indent level by 2
1154+ let b:python_indent_multiline_statement = 1
1155+ let in = "async for _ in (True,\<CR>False):"
1156+ let out = [
1157+ \ 'async for _ in (True,',
1158+ \ ' False):',
1159+ \]
1160+ Assert Equals(Insert(in), Buffer(out))
1161+ End
1162+
1163+ It increases the indent level (hanging indent)
1164+ let in = "async for _ in (\<CR>True,\<CR>False,\<CR>):"
1165+ let out = [
1166+ \ 'async for _ in (',
1167+ \ ' True,',
1168+ \ ' False,',
1169+ \ '):',
1170+ \]
1171+ Assert Equals(Insert(in), Buffer(out))
1172+ End
1173+
1174+ It increases the indent level by 2 (hanging indent)
1175+ let b:python_indent_multiline_statement = 1
1176+ let in = "async for _ in (\<CR>True,\<CR>False,\<CR>):"
1177+ let out = [
1178+ \ 'async for _ in (',
1179+ \ ' True,',
1180+ \ ' False,',
1181+ \ '):',
1182+ \]
1183+ Assert Equals(Insert(in), Buffer(out))
1184+ End
1185+
1186+ It increases the indent level (line continueation)
1187+ let in = "async for _ in True, \\\<CR>False:"
1188+ let out = [
1189+ \ 'async for _ in True, \',
1190+ \ ' False:',
1191+ \]
1192+ Assert Equals(Insert(in), Buffer(out))
1193+ End
1194+
1195+ It indents the else clause
1196+ let in = "async for _ in range(1):\<CR>"
1197+ let in .= "async for _ in range(2):\<CR>continue\<CR>"
1198+ let in .= "else:\<CR>pass\<CR>"
1199+ let in .= "else:"
1200+ let out = [
1201+ \ 'async for _ in range(1):',
1202+ \ ' async for _ in range(2):',
1203+ \ ' continue',
1204+ \ ' else:',
1205+ \ ' pass',
1206+ \ 'else:',
1207+ \]
1208+ Assert Equals(Insert(in), Buffer(out))
1209+ End
1210+ End
11421211 End
11431212 End
11441213End
0 commit comments