diff options
| author | Gregory Heytings | 2023-02-13 11:44:37 +0100 |
|---|---|---|
| committer | Gregory Heytings | 2023-02-13 11:44:37 +0100 |
| commit | b948d0d7efe4c73a34485238d6a4e1bb5f0cac9e (patch) | |
| tree | 3c1fc837f7094c21d1d35f1e66c657020908ea7f /test/src | |
| parent | cc30422825a5acf460d026bfe912b327b70dedcf (diff) | |
| parent | dcb2379a463678bdadd05ee39d61e7da84c71c5e (diff) | |
| download | emacs-b948d0d7efe4c73a34485238d6a4e1bb5f0cac9e.tar.gz emacs-b948d0d7efe4c73a34485238d6a4e1bb5f0cac9e.zip | |
Merge branch 'scratch/fix-locked-narrowing'
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/buffer-tests.el | 106 |
1 files changed, 106 insertions, 0 deletions
diff --git a/test/src/buffer-tests.el b/test/src/buffer-tests.el index 9d4bbf3e040..0ae78c8d9d9 100644 --- a/test/src/buffer-tests.el +++ b/test/src/buffer-tests.el | |||
| @@ -8539,4 +8539,110 @@ Finally, kill the buffer and its temporary file." | |||
| 8539 | (if f2 (delete-file f2)) | 8539 | (if f2 (delete-file f2)) |
| 8540 | ))) | 8540 | ))) |
| 8541 | 8541 | ||
| 8542 | (ert-deftest test-labeled-narrowing () | ||
| 8543 | "Test `with-narrowing' and `without-narrowing'." | ||
| 8544 | (with-current-buffer (generate-new-buffer " foo" t) | ||
| 8545 | (insert (make-string 5000 ?a)) | ||
| 8546 | (should (= (point-min) 1)) | ||
| 8547 | (should (= (point-max) 5001)) | ||
| 8548 | (with-narrowing | ||
| 8549 | 100 500 :label 'foo | ||
| 8550 | (should (= (point-min) 100)) | ||
| 8551 | (should (= (point-max) 500)) | ||
| 8552 | (widen) | ||
| 8553 | (should (= (point-min) 100)) | ||
| 8554 | (should (= (point-max) 500)) | ||
| 8555 | (narrow-to-region 1 5000) | ||
| 8556 | (should (= (point-min) 100)) | ||
| 8557 | (should (= (point-max) 500)) | ||
| 8558 | (narrow-to-region 50 150) | ||
| 8559 | (should (= (point-min) 100)) | ||
| 8560 | (should (= (point-max) 150)) | ||
| 8561 | (widen) | ||
| 8562 | (should (= (point-min) 100)) | ||
| 8563 | (should (= (point-max) 500)) | ||
| 8564 | (narrow-to-region 400 1000) | ||
| 8565 | (should (= (point-min) 400)) | ||
| 8566 | (should (= (point-max) 500)) | ||
| 8567 | (without-narrowing | ||
| 8568 | :label 'bar | ||
| 8569 | (should (= (point-min) 100)) | ||
| 8570 | (should (= (point-max) 500))) | ||
| 8571 | (without-narrowing | ||
| 8572 | :label 'foo | ||
| 8573 | (should (= (point-min) 1)) | ||
| 8574 | (should (= (point-max) 5001))) | ||
| 8575 | (should (= (point-min) 400)) | ||
| 8576 | (should (= (point-max) 500)) | ||
| 8577 | (widen) | ||
| 8578 | (should (= (point-min) 100)) | ||
| 8579 | (should (= (point-max) 500)) | ||
| 8580 | (with-narrowing | ||
| 8581 | 50 250 :label 'bar | ||
| 8582 | (should (= (point-min) 100)) | ||
| 8583 | (should (= (point-max) 250)) | ||
| 8584 | (widen) | ||
| 8585 | (should (= (point-min) 100)) | ||
| 8586 | (should (= (point-max) 250)) | ||
| 8587 | (without-narrowing | ||
| 8588 | :label 'bar | ||
| 8589 | (should (= (point-min) 100)) | ||
| 8590 | (should (= (point-max) 500)) | ||
| 8591 | (without-narrowing | ||
| 8592 | :label 'foo | ||
| 8593 | (should (= (point-min) 1)) | ||
| 8594 | (should (= (point-max) 5001))) | ||
| 8595 | (should (= (point-min) 100)) | ||
| 8596 | (should (= (point-max) 500))) | ||
| 8597 | (should (= (point-min) 100)) | ||
| 8598 | (should (= (point-max) 250))) | ||
| 8599 | (should (= (point-min) 100)) | ||
| 8600 | (should (= (point-max) 500)) | ||
| 8601 | (with-narrowing | ||
| 8602 | 50 250 :label 'bar | ||
| 8603 | (should (= (point-min) 100)) | ||
| 8604 | (should (= (point-max) 250)) | ||
| 8605 | (with-narrowing | ||
| 8606 | 150 500 :label 'baz | ||
| 8607 | (should (= (point-min) 150)) | ||
| 8608 | (should (= (point-max) 250)) | ||
| 8609 | (without-narrowing | ||
| 8610 | :label 'bar | ||
| 8611 | (should (= (point-min) 150)) | ||
| 8612 | (should (= (point-max) 250))) | ||
| 8613 | (without-narrowing | ||
| 8614 | :label 'foo | ||
| 8615 | (should (= (point-min) 150)) | ||
| 8616 | (should (= (point-max) 250))) | ||
| 8617 | (without-narrowing | ||
| 8618 | :label 'baz | ||
| 8619 | (should (= (point-min) 100)) | ||
| 8620 | (should (= (point-max) 250)) | ||
| 8621 | (without-narrowing | ||
| 8622 | :label 'foo | ||
| 8623 | (should (= (point-min) 100)) | ||
| 8624 | (should (= (point-max) 250))) | ||
| 8625 | (without-narrowing | ||
| 8626 | :label 'bar | ||
| 8627 | (should (= (point-min) 100)) | ||
| 8628 | (should (= (point-max) 500)) | ||
| 8629 | (without-narrowing | ||
| 8630 | :label 'foobar | ||
| 8631 | (should (= (point-min) 100)) | ||
| 8632 | (should (= (point-max) 500))) | ||
| 8633 | (without-narrowing | ||
| 8634 | :label 'foo | ||
| 8635 | (should (= (point-min) 1)) | ||
| 8636 | (should (= (point-max) 5001))) | ||
| 8637 | (should (= (point-min) 100)) | ||
| 8638 | (should (= (point-max) 500))) | ||
| 8639 | (should (= (point-min) 100)) | ||
| 8640 | (should (= (point-max) 250))) | ||
| 8641 | (should (= (point-min) 150)) | ||
| 8642 | (should (= (point-max) 250))) | ||
| 8643 | (should (= (point-min) 100)) | ||
| 8644 | (should (= (point-max) 250)))) | ||
| 8645 | (should (= (point-min) 1)) | ||
| 8646 | (should (= (point-max) 5001)))) | ||
| 8647 | |||
| 8542 | ;;; buffer-tests.el ends here | 8648 | ;;; buffer-tests.el ends here |