[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/compat 639d03eed7 04/13: Restore date tests
From: |
ELPA Syncer |
Subject: |
[elpa] externals/compat 639d03eed7 04/13: Restore date tests |
Date: |
Wed, 4 Jan 2023 11:57:31 -0500 (EST) |
branch: externals/compat
commit 639d03eed7cf0e0b59fbc803b83e0ca479b07653
Author: Daniel Mendler <mail@daniel-mendler.de>
Commit: Daniel Mendler <mail@daniel-mendler.de>
Restore date tests
---
compat-tests.el | 113 ++++++++++++++++++++++++++++----------------------------
1 file changed, 57 insertions(+), 56 deletions(-)
diff --git a/compat-tests.el b/compat-tests.el
index d17d397cca..92120da912 100644
--- a/compat-tests.el
+++ b/compat-tests.el
@@ -39,6 +39,7 @@
(require 'ert)
(require 'compat)
(require 'subr-x)
+(require 'time-date)
(require 'text-property-search nil t)
(setq ert-quiet t)
@@ -1514,6 +1515,62 @@
(should-not (time-equal-p '(1 2 3 4) '(2 2 3 4)))
(should-not (time-equal-p '(2 2 3 4) '(1 2 3 4))))
+(ert-deftest decoded-time-period ()
+ (should-equal 0 (decoded-time-period '()))
+ (should-equal 0 (decoded-time-period '(0)))
+ (should-equal 1 (decoded-time-period '(1)))
+ (should-equal 0.125 (decoded-time-period '((1 . 8))))
+
+ (should-equal 60 (decoded-time-period '(0 1)))
+ (should-equal 61 (decoded-time-period '(1 1)))
+ (should-equal -59 (decoded-time-period '(1 -1)))
+
+ (should-equal (* 60 60) (decoded-time-period '(0 0 1)))
+ (should-equal (+ (* 60 60) 60) (decoded-time-period '(0 1 1)))
+ (should-equal (+ (* 60 60) 120 1) (decoded-time-period '(1 2 1)))
+
+ (should-equal (* 60 60 24) (decoded-time-period '(0 0 0 1)))
+ (should-equal (+ (* 60 60 24) 1) (decoded-time-period '(1 0 0 1)))
+ (should-equal (+ (* 60 60 24) (* 60 60) 60 1) (decoded-time-period '(1 1 1
1)))
+ (should-equal (+ (* 60 60 24) (* 60 60) 120 1) (decoded-time-period '(1 2 1
1)))
+
+ (should-equal (* 60 60 24 30) (decoded-time-period '(0 0 0 0 1)))
+ (should-equal (+ (* 60 60 24 30) 1) (decoded-time-period '(1 0 0 0 1)))
+ (should-equal (+ (* 60 60 24 30) 60 1) (decoded-time-period '(1 1 0 0 1)))
+ (should-equal (+ (* 60 60 24 30) (* 60 60) 60 1)
+ (decoded-time-period '(1 1 1 0 1)))
+ (should-equal (+ (* 60 60 24 30) (* 60 60 24) (* 60 60) 120 1)
+ (decoded-time-period '(1 2 1 1 1)))
+
+ (should-equal (* 60 60 24 365) (decoded-time-period '(0 0 0 0 0 1)))
+ (should-equal (+ (* 60 60 24 365) 1)
+ (decoded-time-period '(1 0 0 0 0 1)))
+ (should-equal (+ (* 60 60 24 365) 60 1)
+ (decoded-time-period '(1 1 0 0 0 1)))
+ (should-equal (+ (* 60 60 24 365) (* 60 60) 60 1)
+ (decoded-time-period '(1 1 1 0 0 1)))
+ (should-equal (+ (* 60 60 24 365) (* 60 60 24) (* 60 60) 60 1)
+ (decoded-time-period '(1 1 1 1 0 1)))
+ (should-equal (+ (* 60 60 24 365)
+ (* 60 60 24 30)
+ (* 60 60 24)
+ (* 60 60)
+ 120 1)
+ (decoded-time-period '(1 2 1 1 1 1)))
+
+ (should-error (decoded-time-period 'a) :type 'wrong-type-argument)
+ (should-error (decoded-time-period '(0 a)) :type 'wrong-type-argument)
+ (should-error (decoded-time-period '(0 0 a)) :type 'wrong-type-argument)
+ (should-error (decoded-time-period '(0 0 0 a)) :type 'wrong-type-argument)
+ (should-error (decoded-time-period '(0 0 0 0 a)) :type 'wrong-type-argument)
+ (should-error (decoded-time-period '(0 0 0 0 0 a)) :type
'wrong-type-argument))
+
+(ert-deftest date-days-in-month ()
+ (should-equal 31 (date-days-in-month 2020 1))
+ (should-equal 30 (date-days-in-month 2020 4))
+ (should-equal 29 (date-days-in-month 2020 2))
+ (should-equal 28 (date-days-in-month 2021 2)))
+
;; (ert-deftest regexp-opt ()
;; ;; Ensure `regexp-opt' doesn't change the existing
;; ;; behaviour:
@@ -1584,62 +1641,6 @@
;; (when (boundp 'regexp-unmatchable)
;; (should-not (string-match-p regexp-unmatchable str)))))
-;; (ert-deftest date-days-in-month
-;; (should-equal 31 2020 1)
-;; (should-equal 30 2020 4)
-;; (should-equal 29 2020 2)
-;; (should-equal 28 2021 2))
-
-;; (ert-deftest decoded-time-period
-;; (should-equal 0 '())
-;; (should-equal 0 '(0))
-;; (should-equal 1 '(1))
-;; (should-equal 0.125 '((1 . 8)))
-
-;; (should-equal 60 '(0 1))
-;; (should-equal 61 '(1 1))
-;; (should-equal -59 '(1 -1))
-
-;; (should-equal (* 60 60) '(0 0 1))
-;; (should-equal (+ (* 60 60) 60) '(0 1 1))
-;; (should-equal (+ (* 60 60) 120 1) '(1 2 1))
-
-;; (should-equal (* 60 60 24) '(0 0 0 1))
-;; (should-equal (+ (* 60 60 24) 1) '(1 0 0 1))
-;; (should-equal (+ (* 60 60 24) (* 60 60) 60 1) '(1 1 1 1))
-;; (should-equal (+ (* 60 60 24) (* 60 60) 120 1) '(1 2 1 1))
-
-;; (should-equal (* 60 60 24 30) '(0 0 0 0 1))
-;; (should-equal (+ (* 60 60 24 30) 1) '(1 0 0 0 1))
-;; (should-equal (+ (* 60 60 24 30) 60 1) '(1 1 0 0 1))
-;; (should-equal (+ (* 60 60 24 30) (* 60 60) 60 1)
-;; '(1 1 1 0 1))
-;; (should-equal (+ (* 60 60 24 30) (* 60 60 24) (* 60 60) 120 1)
-;; '(1 2 1 1 1))
-
-;; (should-equal (* 60 60 24 365) '(0 0 0 0 0 1))
-;; (should-equal (+ (* 60 60 24 365) 1)
-;; '(1 0 0 0 0 1))
-;; (should-equal (+ (* 60 60 24 365) 60 1)
-;; '(1 1 0 0 0 1))
-;; (should-equal (+ (* 60 60 24 365) (* 60 60) 60 1)
-;; '(1 1 1 0 0 1))
-;; (should-equal (+ (* 60 60 24 365) (* 60 60 24) (* 60 60) 60 1)
-;; '(1 1 1 1 0 1))
-;; (should-equal (+ (* 60 60 24 365)
-;; (* 60 60 24 30)
-;; (* 60 60 24)
-;; (* 60 60)
-;; 120 1)
-;; '(1 2 1 1 1 1))
-
-;; (should-error wrong-type-argument 'a)
-;; (should-error wrong-type-argument '(0 a))
-;; (should-error wrong-type-argument '(0 0 a))
-;; (should-error wrong-type-argument '(0 0 0 a))
-;; (should-error wrong-type-argument '(0 0 0 0 a))
-;; (should-error wrong-type-argument '(0 0 0 0 0 a)))
-
;; TODO func-arity seems broken
;; (ert-deftest func-arity
;; (should-equal '(0 . 0) (func-arity (lambda ()))))
- [elpa] externals/compat updated (241e38bb45 -> 18a83e1dff), ELPA Syncer, 2023/01/04
- [elpa] externals/compat c2e0835dd3 03/13: Restore tests, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 1b1d633c78 01/13: Restore tests, ELPA Syncer, 2023/01/04
- [elpa] externals/compat c314cdf427 02/13: Remove realnames, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 20d103c09c 09/13: Restore if-let* test, ELPA Syncer, 2023/01/04
- [elpa] externals/compat b97b756871 07/13: Restore if-let test, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 414135b6f9 06/13: Restore and-let test, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 639d03eed7 04/13: Restore date tests,
ELPA Syncer <=
- [elpa] externals/compat 27ad893406 05/13: Update version number, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 79d3562f6d 11/13: Add when-let test, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 337c32e588 12/13: Restore regexp tests, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 18a83e1dff 13/13: Add UNTESTED labels behind compat-defuns for greppability, ELPA Syncer, 2023/01/04
- [elpa] externals/compat 8a479d7b52 10/13: Add when-let* test, ELPA Syncer, 2023/01/04
- [elpa] externals/compat efb1d1c081 08/13: Disable broken test, ELPA Syncer, 2023/01/04