xwwp-test.el 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 'xwwp)
  17. (ert-deftest test-xwwp-js-register-function ()
  18. (let ((xwwp-js-scripts '()))
  19. (xwwp-js-register-function 'namespace1 'fun1 "script 1.0")
  20. (should (equal '((namespace1 . ((fun1 . "script 1.0")))) xwwp-js-scripts))
  21. (xwwp-js-register-function 'namespace1 'fun1 "script 1.1")
  22. (should (equal '((namespace1 . ((fun1 . "script 1.1")))) xwwp-js-scripts))
  23. (xwwp-js-register-function 'namespace1 'fun2 "script 2.0")
  24. (should (equal '((namespace1 . ((fun2 . "script 2.0") (fun1 . "script 1.1")))) xwwp-js-scripts))
  25. (xwwp-js-register-function 'namespace1 'fun2 "script 2.1")
  26. (should (equal '((namespace1 . ((fun2 . "script 2.1") (fun1 . "script 1.1")))) xwwp-js-scripts))
  27. (xwwp-js-register-function 'namespace1 'fun1 "script 1.2")
  28. (should (equal '((namespace1 . ((fun1 . "script 1.2") (fun2 . "script 2.1")))) xwwp-js-scripts))
  29. (xwwp-js-register-function 'namespace2 'fun1 "script 1.0")
  30. (should (equal '((namespace2 . ((fun1 . "script 1.0")))
  31. (namespace1 . ((fun1 . "script 1.2") (fun2 . "script 2.1"))))
  32. xwwp-js-scripts))
  33. (xwwp-js-register-function 'namespace2 'fun2 "script 2.0")
  34. (should (equal '((namespace2 . ((fun2 . "script 2.0") (fun1 . "script 1.0")))
  35. (namespace1 . ((fun1 . "script 1.2") (fun2 . "script 2.1"))))
  36. xwwp-js-scripts))))
  37. (provide 'xwwp-test)
  38. ;;; xwwp-test.el ends here