-;;; dns-mode.el --- a mode for viewing/editing Domain Name System master files
+;;; dns-mode.el --- a mode for viewing/editing Domain Name System master files -*- lexical-binding: t -*-
;; Copyright (C) 2000-2001, 2004-2021 Free Software Foundation, Inc.
(defface dns-mode-control-entity '((t :inherit font-lock-keyword-face))
"Face used for DNS control entities, e.g. $ORIGIN."
- :version "26.1"
- :group 'dns-mode)
+ :version "26.1")
(defface dns-mode-bad-control-entity '((t :inherit font-lock-warning-face))
"Face used for non-standard DNS control entities, e.g. $FOO."
- :version "26.1"
- :group 'dns-mode)
+ :version "26.1")
(defface dns-mode-type '((t :inherit font-lock-type-face))
"Face used for DNS types, e.g., SOA."
- :version "26.1"
- :group 'dns-mode)
+ :version "26.1")
(defface dns-mode-class '((t :inherit font-lock-constant-face))
"Face used for DNS classes, e.g., IN."
- :version "26.1"
- :group 'dns-mode)
+ :version "26.1")
(defvar dns-mode-control-entity-face ''dns-mode-control-entity
"Name of face used for control entities, e.g. $ORIGIN.")
(,(regexp-opt dns-mode-types) 0 ,dns-mode-type-face))
"Font lock keywords used to highlight text in DNS master file mode."
:version "26.1"
- :type 'sexp
- :group 'dns-mode)
+ :type 'sexp)
(defcustom dns-mode-soa-auto-increment-serial t
"Whether to increment the SOA serial number automatically.
:type '(choice (const :tag "Always" t)
(const :tag "Ask" ask)
(const :tag "Never" nil))
- :safe 'symbolp
- :group 'dns-mode)
+ :safe 'symbolp)
;; Syntax table.
(require 'ert)
(require 'dns-mode)
+(ert-deftest dns-mode-tests-dns-mode-soa-increment-serial ()
+ (with-temp-buffer
+ (insert "$TTL 86400
+@ IN SOA ns.icann.org. noc.dns.icann.org. (
+ 2015080302 ;Serial
+ 7200 ;Refresh
+ 3600 ;Retry
+ 1209600 ;Expire
+ 3600 ;Negative response caching TTL\n)")
+ (dns-mode-soa-increment-serial)
+ ;; Number is updated from 2015080302 to the current date
+ ;; (actually, just ensure the year part is later than 2020).
+ (should (string-match "$TTL 86400
+@ IN SOA ns.icann.org. noc.dns.icann.org. (
+ 20[2-9][0-9]+ ;Serial
+ 7200 ;Refresh
+ 3600 ;Retry
+ 1209600 ;Expire
+ 3600 ;Negative response caching TTL\n)"
+ (buffer-string)))))
+
;;; IPv6 reverse zones
(ert-deftest dns-mode-ipv6-conversion ()
(let ((address "2001:db8::42"))