xwwp-test.el 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. ;;; xwwp-test.el -- xwwp test suite -*- lexical-binding: t; -*-
  2. ;; Copyright (C) 2020 Damien Merenne <dam@cosinux.org>
  3. ;; This program is free software: you can redistribute it and/or modify
  4. ;; it under the terms of the GNU General Public License as published by
  5. ;; the Free Software Foundation, either version 3 of the License, or
  6. ;; (at your option) any later version.
  7. ;; This program is distributed in the hope that it will be useful,
  8. ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. ;; GNU General Public License for more details.
  11. ;; You should have received a copy of the GNU General Public License
  12. ;; along with this program. If not, see <http://www.gnu.org/licenses/>.
  13. ;;; Commentary:
  14. ;; Test suite for xwidget-webkit-plus feature
  15. ;;; Code:
  16. (require 'test-helper)
  17. (require 'xwwp)
  18. (ert-deftest test-xwwp-js-register-function ()
  19. (let ((xwwp-js-scripts '()))
  20. (xwwp-js-register-function 'namespace1 'fun1 "script 1.0")
  21. (should (equal '((namespace1 . ((fun1 . "script 1.0")))) xwwp-js-scripts))
  22. (xwwp-js-register-function 'namespace1 'fun1 "script 1.1")
  23. (should (equal '((namespace1 . ((fun1 . "script 1.1")))) xwwp-js-scripts))
  24. (xwwp-js-register-function 'namespace1 'fun2 "script 2.0")
  25. (should (equal '((namespace1 . ((fun2 . "script 2.0") (fun1 . "script 1.1")))) xwwp-js-scripts))
  26. (xwwp-js-register-function 'namespace1 'fun2 "script 2.1")
  27. (should (equal '((namespace1 . ((fun2 . "script 2.1") (fun1 . "script 1.1")))) xwwp-js-scripts))
  28. (xwwp-js-register-function 'namespace1 'fun1 "script 1.2")
  29. (should (equal '((namespace1 . ((fun1 . "script 1.2") (fun2 . "script 2.1")))) xwwp-js-scripts))
  30. (xwwp-js-register-function 'namespace2 'fun1 "script 1.0")
  31. (should (equal '((namespace2 . ((fun1 . "script 1.0")))
  32. (namespace1 . ((fun1 . "script 1.2") (fun2 . "script 2.1"))))
  33. xwwp-js-scripts))
  34. (xwwp-js-register-function 'namespace2 'fun2 "script 2.0")
  35. (should (equal '((namespace2 . ((fun2 . "script 2.0") (fun1 . "script 1.0")))
  36. (namespace1 . ((fun1 . "script 1.2") (fun2 . "script 2.1"))))
  37. xwwp-js-scripts))))
  38. (provide 'xwwp-test)
  39. ;;; xwwp-test.el ends here