123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185 |
- (ert-deftest test-org-pcomplete/clocktable ()
- "Test completion of clock table parameters."
- (should
- (equal "#+begin: clocktable :scope"
- (org-test-with-temp-text "#+begin: clocktable :sco<point>"
- (pcomplete)
- (buffer-string)))))
- (ert-deftest test-org-pcomplete/drawer ()
- "Test drawer completion."
- (should
- (equal "* Foo\n:PROPERTIES:"
- (org-test-with-temp-text "* Foo\n:<point>"
- (pcomplete)
- (buffer-string))))
- (should
- (equal ":DRAWER:\nContents\n:END:\n* Foo\n:DRAWER:"
- (org-test-with-temp-text ":DRAWER:\nContents\n:END:\n* Foo\n:D<point>"
- (pcomplete)
- (buffer-string)))))
- (ert-deftest test-org-pcomplete/entity ()
- "Test entity completion."
- (should
- (equal "\\alpha"
- (org-test-with-temp-text "\\alp<point>"
- (pcomplete)
- (buffer-string))))
- (should
- (equal "\\frac12"
- (org-test-with-temp-text "\\frac1<point>"
- (pcomplete)
- (buffer-string)))))
- (ert-deftest test-org-pcomplete/keyword ()
- "Test keyword and block completion."
- (should
- (string-prefix-p
- "#+startup: "
- (org-test-with-temp-text "#+start<point>"
- (pcomplete)
- (buffer-string))
- t))
- (should
- (string-prefix-p
- "#+begin_center"
- (org-test-with-temp-text "#+begin_ce<point>"
- (pcomplete)
- (buffer-string))
- t)))
- (ert-deftest test-org-pcomplete/src-block ()
- "Test Babel source block header arguments completion."
- (should
- (string-prefix-p
- "#+begin_src emacs-lisp"
- (org-test-with-temp-text "#+begin_src emac<point>"
- (pcomplete)
- (buffer-string))))
- (should
- (string-prefix-p
- "#+begin_src emacs-lisp :session"
- (org-test-with-temp-text "#+begin_src emacs-lisp :sess<point>"
- (pcomplete)
- (buffer-string)))))
- (ert-deftest test-org-pcomplete/link ()
- "Test link completion"
- (should
- (equal "[[org:"
- (org-test-with-temp-text "[[o<point>"
- (let ((org-link-abbrev-alist '(("org" . "https://orgmode.org/"))))
- (pcomplete))
- (buffer-string))))
- (should-not
- (equal "[org:"
- (org-test-with-temp-text "[[o<point>"
- (let ((org-link-abbrev-alist '(("org" . "https://orgmode.org/"))))
- (pcomplete))
- (buffer-string)))))
- (ert-deftest test-org-pcomplete/prop ()
- "Test property completion."
- (should
- (equal
- "
- * a
- :PROPERTIES:
- :pname:\s
- :END:
- * b
- :PROPERTIES:
- :pname: pvalue
- :END:
- "
- (org-test-with-temp-text "
- * a
- :PROPERTIES:
- :pna<point>
- :END:
- * b
- :PROPERTIES:
- :pname: pvalue
- :END:
- "
- (pcomplete)
- (buffer-string)))))
- (ert-deftest test-org-pcomplete/search-heading ()
- "Test search heading completion."
- (should
- (equal "* Foo\n[[*Foo"
- (org-test-with-temp-text "* Foo\n[[*<point>"
- (pcomplete)
- (buffer-string)))))
- (ert-deftest test-org-pcomplete/tag ()
- "Test tag completion."
-
- (should
- (equal "* H :foo:"
- (org-test-with-temp-text "* H :<point>"
- (let ((org-current-tag-alist '(("foo")))) (pcomplete))
- (buffer-string))))
- (should
- (equal "* H :foo:bar:"
- (org-test-with-temp-text "* H :foo:b<point>"
- (let ((org-current-tag-alist '(("bar")))) (pcomplete))
- (buffer-string))))
-
-
- (should
- (equal "* H1 :bar:\n* H2 :bar:"
- (org-test-with-temp-text "* H1 :bar:\n* H2 :<point>"
- (let ((org-current-tag-alist nil)) (pcomplete))
- (buffer-string))))
-
- (should
- (equal "* H :notag: :real:tags:"
- (org-test-with-temp-text "* H :notag:<point> :real:tags:"
- (let ((org-current-tag-alist '(("foo")))) (pcomplete))
- (buffer-string))))
-
- (should
- (equal "* foo: :foo:"
- (org-test-with-temp-text "* foo: :<point>"
- (let ((org-current-tag-alist '(("foo")))) (pcomplete))
- (buffer-string)))))
- (ert-deftest test-org-pcomplete/todo ()
- "Test TODO completion."
- (should
- (equal "* TODO"
- (org-test-with-temp-text "* T<point>"
- (pcomplete)
- (buffer-string)))))
- (provide 'test-org-pcomplete)
|