diff options
| author | Stefan Kangas | 2020-04-26 01:00:39 +0200 |
|---|---|---|
| committer | Stefan Kangas | 2020-04-26 01:11:05 +0200 |
| commit | 7b82650c60bd044c046601fc337c8a46b4fb853c (patch) | |
| tree | 0c11be32408477af80bcd3c14787230e15571b7f /test | |
| parent | 0e2cd5f5ab8e3e870fde7c70cbc75fdd2b405746 (diff) | |
| download | emacs-7b82650c60bd044c046601fc337c8a46b4fb853c.tar.gz emacs-7b82650c60bd044c046601fc337c8a46b4fb853c.zip | |
Use lexical-binding in dig.el and add tests
* lisp/net/dig.el: Use lexical-binding.
(dig-program, dig-dns-server, dig-font-lock-keywords): Remove
redundant :group args.
* test/lisp/net/dig-tests.el: New file.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/net/dig-tests.el | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/test/lisp/net/dig-tests.el b/test/lisp/net/dig-tests.el new file mode 100644 index 00000000000..1b14384634e --- /dev/null +++ b/test/lisp/net/dig-tests.el | |||
| @@ -0,0 +1,56 @@ | |||
| 1 | ;;; dig-tests.el --- Tests for dig.el -*- lexical-binding:t -*- | ||
| 2 | |||
| 3 | ;; Copyright (C) 2020 Free Software Foundation, Inc. | ||
| 4 | |||
| 5 | ;; This file is part of GNU Emacs. | ||
| 6 | |||
| 7 | ;; GNU Emacs is free software: you can redistribute it and/or modify | ||
| 8 | ;; it under the terms of the GNU General Public License as published by | ||
| 9 | ;; the Free Software Foundation, either version 3 of the License, or | ||
| 10 | ;; (at your option) any later version. | ||
| 11 | |||
| 12 | ;; GNU Emacs is distributed in the hope that it will be useful, | ||
| 13 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 14 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 15 | ;; GNU General Public License for more details. | ||
| 16 | |||
| 17 | ;; You should have received a copy of the GNU General Public License | ||
| 18 | ;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. | ||
| 19 | |||
| 20 | ;;; Commentary: | ||
| 21 | |||
| 22 | ;;; Code: | ||
| 23 | |||
| 24 | (require 'ert) | ||
| 25 | (require 'dig) | ||
| 26 | |||
| 27 | (defvar dig-test-result-data " | ||
| 28 | ; <<>> DiG 9.11.16-2-Debian <<>> gnu.org | ||
| 29 | ;; global options: +cmd | ||
| 30 | ;; Got answer: | ||
| 31 | ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 7777 | ||
| 32 | ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 | ||
| 33 | |||
| 34 | ;; OPT PSEUDOSECTION: | ||
| 35 | ; EDNS: version: 0, flags:; udp: 4096 | ||
| 36 | ;; QUESTION SECTION: | ||
| 37 | ;gnu.org. IN A | ||
| 38 | |||
| 39 | ;; ANSWER SECTION: | ||
| 40 | gnu.org. 300 IN A 111.11.111.111 | ||
| 41 | |||
| 42 | ;; Query time: 127 msec | ||
| 43 | ;; SERVER: 192.168.0.1#53(192.168.0.1) | ||
| 44 | ;; WHEN: Sun Apr 26 00:47:55 CEST 2020 | ||
| 45 | ;; MSG SIZE rcvd: 52 | ||
| 46 | |||
| 47 | " "Data used to test dig.el.") | ||
| 48 | |||
| 49 | (ert-deftest dig-test-dig-extract-rr () | ||
| 50 | (with-temp-buffer | ||
| 51 | (insert dig-test-result-data) | ||
| 52 | (should (equal (dig-extract-rr "gnu.org") | ||
| 53 | "gnu.org. 300 IN A 111.11.111.111")))) | ||
| 54 | |||
| 55 | (provide 'dig-tests) | ||
| 56 | ;;; dig-tests.el ends here | ||