patch 8.1.1626: no test for closing a popup window with a modified buffer
Problem: No test for closing a popup window with a modified buffer.
Solution: Add a test. Add "popups" to getbufinfo().
diff --git a/src/testdir/test_popupwin.vim b/src/testdir/test_popupwin.vim
index f7579f5..4e798c6 100644
--- a/src/testdir/test_popupwin.vim
+++ b/src/testdir/test_popupwin.vim
@@ -1710,3 +1710,30 @@
endfor
call popup_clear()
endfunc
+
+func Test_popupwin_buf_close()
+ let buf = bufadd('Xtestbuf')
+ call bufload(buf)
+ call setbufline(buf, 1, ['just', 'some', 'lines'])
+ let winid = popup_create(buf, {})
+ redraw
+ call assert_equal(3, popup_getpos(winid).height)
+ let bufinfo = getbufinfo(buf)[0]
+ call assert_equal(1, bufinfo.changed)
+ call assert_equal(0, bufinfo.hidden)
+ call assert_equal(0, bufinfo.listed)
+ call assert_equal(1, bufinfo.loaded)
+ call assert_equal([], bufinfo.windows)
+ call assert_equal([winid], bufinfo.popups)
+
+ call popup_close(winid)
+ call assert_equal({}, popup_getpos(winid))
+ let bufinfo = getbufinfo(buf)[0]
+ call assert_equal(1, bufinfo.changed)
+ call assert_equal(1, bufinfo.hidden)
+ call assert_equal(0, bufinfo.listed)
+ call assert_equal(1, bufinfo.loaded)
+ call assert_equal([], bufinfo.windows)
+ call assert_equal([], bufinfo.popups)
+ exe 'bwipe! ' .. buf
+endfunc