|
@@ -2340,6 +2340,44 @@ See also `test-org-table/copy-field'."
|
|
|
(ignore-errors (org-table-previous-field))
|
|
|
(char-after)))))
|
|
|
|
|
|
+
|
|
|
+;;; Deleting columns
|
|
|
+(ert-deftest test-org-table/delete-column ()
|
|
|
+ "Test `org-table-delete-column'."
|
|
|
+ ;; Error when outside a table.
|
|
|
+ (should-error
|
|
|
+ (org-test-with-temp-text "Paragraph"
|
|
|
+ (org-table-delete-column)))
|
|
|
+ ;; Delete first column.
|
|
|
+ (should
|
|
|
+ (equal "| a |\n"
|
|
|
+ (org-test-with-temp-text
|
|
|
+ "| <point> | a |\n"
|
|
|
+ (org-table-delete-column)
|
|
|
+ (buffer-string))))
|
|
|
+ ;; Delete column and check location of point.
|
|
|
+ (should
|
|
|
+ (= 2
|
|
|
+ (org-test-with-temp-text
|
|
|
+ "| a | <point>b | c |"
|
|
|
+ (org-table-delete-column)
|
|
|
+ (org-table-current-column))))
|
|
|
+ ;; Delete column when at end of line and immediately after a "|".
|
|
|
+ (should
|
|
|
+ (equal "| a |\n"
|
|
|
+ (org-test-with-temp-text
|
|
|
+ "| a | b |<point>\n"
|
|
|
+ (org-table-delete-column)
|
|
|
+ (buffer-string))))
|
|
|
+ ;; Delete two columns starting with the last column.
|
|
|
+ (should
|
|
|
+ (equal "| a |\n"
|
|
|
+ (org-test-with-temp-text
|
|
|
+ "| a | b | c<point> |"
|
|
|
+ (org-table-delete-column)
|
|
|
+ (org-table-delete-column)
|
|
|
+ (buffer-string)))))
|
|
|
+
|
|
|
|
|
|
;;; Inserting rows, inserting columns
|
|
|
|