Add an extensive test for labeled (locked) narrowing
* test/src/buffer-tests.el (test-labeled-narrowing): New test.
This commit is contained in:
parent
79ce185ad1
commit
2956e54b1d
1 changed files with 106 additions and 0 deletions
|
@ -8539,4 +8539,110 @@ Finally, kill the buffer and its temporary file."
|
|||
(if f2 (delete-file f2))
|
||||
)))
|
||||
|
||||
(ert-deftest test-labeled-narrowing ()
|
||||
"Test `with-narrowing' and `without-narrowing'."
|
||||
(with-current-buffer (generate-new-buffer " foo" t)
|
||||
(insert (make-string 5000 ?a))
|
||||
(should (= (point-min) 1))
|
||||
(should (= (point-max) 5001))
|
||||
(with-narrowing
|
||||
100 500 :label 'foo
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 500))
|
||||
(widen)
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 500))
|
||||
(narrow-to-region 1 5000)
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 500))
|
||||
(narrow-to-region 50 150)
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 150))
|
||||
(widen)
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 500))
|
||||
(narrow-to-region 400 1000)
|
||||
(should (= (point-min) 400))
|
||||
(should (= (point-max) 500))
|
||||
(without-narrowing
|
||||
:label 'bar
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 500)))
|
||||
(without-narrowing
|
||||
:label 'foo
|
||||
(should (= (point-min) 1))
|
||||
(should (= (point-max) 5001)))
|
||||
(should (= (point-min) 400))
|
||||
(should (= (point-max) 500))
|
||||
(widen)
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 500))
|
||||
(with-narrowing
|
||||
50 250 :label 'bar
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 250))
|
||||
(widen)
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 250))
|
||||
(without-narrowing
|
||||
:label 'bar
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 500))
|
||||
(without-narrowing
|
||||
:label 'foo
|
||||
(should (= (point-min) 1))
|
||||
(should (= (point-max) 5001)))
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 500)))
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 250)))
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 500))
|
||||
(with-narrowing
|
||||
50 250 :label 'bar
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 250))
|
||||
(with-narrowing
|
||||
150 500 :label 'baz
|
||||
(should (= (point-min) 150))
|
||||
(should (= (point-max) 250))
|
||||
(without-narrowing
|
||||
:label 'bar
|
||||
(should (= (point-min) 150))
|
||||
(should (= (point-max) 250)))
|
||||
(without-narrowing
|
||||
:label 'foo
|
||||
(should (= (point-min) 150))
|
||||
(should (= (point-max) 250)))
|
||||
(without-narrowing
|
||||
:label 'baz
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 250))
|
||||
(without-narrowing
|
||||
:label 'foo
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 250)))
|
||||
(without-narrowing
|
||||
:label 'bar
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 500))
|
||||
(without-narrowing
|
||||
:label 'foobar
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 500)))
|
||||
(without-narrowing
|
||||
:label 'foo
|
||||
(should (= (point-min) 1))
|
||||
(should (= (point-max) 5001)))
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 500)))
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 250)))
|
||||
(should (= (point-min) 150))
|
||||
(should (= (point-max) 250)))
|
||||
(should (= (point-min) 100))
|
||||
(should (= (point-max) 250))))
|
||||
(should (= (point-min) 1))
|
||||
(should (= (point-max) 5001))))
|
||||
|
||||
;;; buffer-tests.el ends here
|
||||
|
|
Loading…
Add table
Reference in a new issue