test-org.el 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. ;;; test-org.el
  2. ;; Copyright (c) ߚ David Maus
  3. ;; Authors: David Maus
  4. ;; Released under the GNU General Public License version 3
  5. ;; see: http://www.gnu.org/licenses/gpl-3.0.html
  6. ;;;; Comments:
  7. ;; Template test file for Org-mode tests
  8. ;;; Code:
  9. (let ((load-path (cons (expand-file-name
  10. ".." (file-name-directory
  11. (or load-file-name buffer-file-name)))
  12. load-path)))
  13. (require 'org-test)
  14. (require 'org-test-ob-consts))
  15. ;;; Tests
  16. (ert-deftest test-org/org-link-escape-ascii-character ()
  17. "Escape an ascii character."
  18. (should
  19. (string=
  20. "%5B"
  21. (org-link-escape "["))))
  22. (ert-deftest test-org/org-link-escape-ascii-ctrl-character ()
  23. "Escape an ascii control character."
  24. (should
  25. (string=
  26. "%09"
  27. (org-link-escape "\t"))))
  28. (ert-deftest test-org/org-link-escape-multibyte-character ()
  29. "Escape an unicode multibyte character."
  30. (should
  31. (string=
  32. "%E2%82%AC"
  33. (org-link-escape "€"))))
  34. (ert-deftest test-org/org-link-escape-custom-table ()
  35. "Escape string with custom character table."
  36. (should
  37. (string=
  38. "Foo%3A%42ar%0A"
  39. (org-link-escape "Foo:Bar\n" '(?\: ?\B)))))
  40. (ert-deftest test-org/org-link-escape-custom-table-merge ()
  41. "Escape string with custom table merged with default table."
  42. (should
  43. (string=
  44. "%5BF%6F%6F%3A%42ar%0A%5D"
  45. (org-link-escape "[Foo:Bar\n]" '(?\: ?\B ?\o) t))))
  46. (ert-deftest test-org/org-link-unescape-ascii-character ()
  47. "Unescape an ascii character."
  48. (should
  49. (string=
  50. "["
  51. (org-link-unescape "%5B"))))
  52. (ert-deftest test-org/org-link-unescape-ascii-ctrl-character ()
  53. "Unescpae an ascii control character."
  54. (should
  55. (string=
  56. "\n"
  57. (org-link-unescape "%0A"))))
  58. (ert-deftest test-org/org-link-unescape-multibyte-character ()
  59. "Unescape unicode multibyte character."
  60. (should
  61. (string=
  62. "€"
  63. (org-link-unescape "%E2%82%AC"))))
  64. (ert-deftest test-org/org-link-unescape-ascii-extended-char ()
  65. "Unescape old style percent escaped character."
  66. (should
  67. (string=
  68. "àâçèéêîôùû"
  69. (org-link-unescape "%E0%E2%E7%E8%E9%EA%EE%F4%F9%FB"))))
  70. (provide 'test-org)
  71. ;;; test-org.el ends here