emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/hyperbole 44b5b447f7 101/143: Add hsettings tests (#452


From: ELPA Syncer
Subject: [elpa] externals/hyperbole 44b5b447f7 101/143: Add hsettings tests (#452)
Date: Mon, 19 Feb 2024 15:59:17 -0500 (EST)

branch: externals/hyperbole
commit 44b5b447f78b5f1960573b53c04ff97d79841412
Author: Mats Lidell <mats.lidell@lidells.se>
Commit: GitHub <noreply@github.com>

    Add hsettings tests (#452)
---
 ChangeLog              |  3 +++
 test/MANIFEST          |  1 +
 test/hsettings-test.el | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 50 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 4a93ef7d29..5d8ebac5e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2024-01-20  Mats Lidell  <matsl@gnu.org>
 
+* test/hsettings-test.el: New test file for hsettings.
+    (hsettings-test--hyperbole-web-search): Test hyperbole-web-search.
+
 * Makefile (package-lint): Add explicit loading of package-lint from Melpa
     for this target. Only needed there.
 
diff --git a/test/MANIFEST b/test/MANIFEST
index a67e84cc0f..99562e0c88 100644
--- a/test/MANIFEST
+++ b/test/MANIFEST
@@ -9,6 +9,7 @@ hibtypes-tests.el       - unit test for hib-kbd
 hmouse-drv-tests.el     - hmouse-drv unit tests
 hmouse-info-tests.el    - hmouse-info unit tests
 hpath-tests.el          - unit tests for hpath
+hsettings-test.el       - unit tests for hsettings
 hsys-org-tests.el       - hsys-org tests
 hui-register-tests.el   - test for hui-register
 hui-select-tests.el     - hui-select tests
diff --git a/test/hsettings-test.el b/test/hsettings-test.el
new file mode 100644
index 0000000000..380cdfcf3d
--- /dev/null
+++ b/test/hsettings-test.el
@@ -0,0 +1,46 @@
+;;; hsettings-test.el --- one line summary                -*- lexical-binding: 
t; -*-
+;;
+;; Author:       Mats Lidell
+;;
+;; Orig-Date:    20-Jan-24 at 12:28:01
+;; Last-Mod:     20-Jan-24 at 14:25:44 by Mats Lidell
+;;
+;; SPDX-License-Identifier: GPL-3.0-or-later
+;;
+;; Copyright (C) 2024  Free Software Foundation, Inc.
+;; See the "HY-COPY" file for license information.
+;;
+;; This file is part of GNU Hyperbole.
+
+;;; Commentary:
+;;
+
+;;; Code:
+
+(require 'ert)
+(require 'el-mock)
+(require 'hsettings)
+
+(ert-deftest hsettings-test--hyperbole-web-search ()
+  "Verify `hyperbole-web-search´."
+  (mocklet (((browse-url "http://www.google.com/search?q=hyperbole";) => 
"return"))
+    (should (string= (hyperbole-web-search "google" "hyperbole" nil) 
"return")))
+  (should (string= (hyperbole-web-search "google" "hyperbole" t) 
"http://www.google.com/search?q=hyperbole";))
+  (should-error (hyperbole-web-search "unknown" "hyperbole" nil))
+  (should-error (hyperbole-web-search "unknown" "hyperbole" t))
+
+  ;; Jump
+  ;; Fails due to being called with argument: See test below.
+  ;; (mocklet (((webjump) => "return"))
+  ;;   (should (string= (hyperbole-web-search "Jump" "arg" nil) "return")))
+  (should (equal (hyperbole-web-search "Jump" "arg" t) '(webjump "arg"))))
+
+(ert-deftest hsettings-test--hyperbole-web-search-webjump-called-with-arg ()
+  "Verify `hyperbole-web-search´."
+  :expected-result :failed
+  ;; Jump
+  (mocklet (((webjump) => "return"))
+    (should (string= (hyperbole-web-search "Jump" "arg" nil) "return"))))
+
+(provide 'hsettings-test)
+;;; hsettings-test.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]