Skip to content

Commit 80a029a

Browse files
committed
Convert testing to use fiasco instead of stefil
1 parent 4fa799a commit 80a029a

File tree

8 files changed

+31
-38
lines changed

8 files changed

+31
-38
lines changed

local-time.asd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
:version "1.0.6"
1515
:author "Daniel Lowe <dlowe@dlowe.net>"
1616
:description "Testing code for the local-time library"
17-
:depends-on (:hu.dwim.stefil
18-
:local-time)
19-
:perform (test-op (o s) (uiop:symbol-call '#:hu.dwim.stefil
20-
'#:funcall-test-with-feedback-message
21-
(uiop:find-symbol* '#:test '#:local-time.test)))
17+
:depends-on (:fiasco :local-time)
18+
:perform (test-op (o s) (uiop:symbol-call '#:fiasco
19+
'#:run-package-tests
20+
:package
21+
(find-package '#:local-time.test)))
2222
:components ((:module "test"
2323
:serial t
2424
:components ((:file "package")

src/local-time.lisp

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
(daylight-p nil))
1414

1515
(defstruct timezone
16-
(transitions #(0) :type simple-vector)
17-
(indexes #(0) :type simple-vector)
16+
(transitions (coerce #(0) '(simple-array fixnum (1))) :type (simple-array fixnum (*)))
17+
(indexes (coerce #(0) '(simple-array fixnum (1))) :type (simple-array fixnum (*)))
1818
(subzones #() :type simple-vector)
1919
(leap-seconds nil :type list)
2020
(path nil)
@@ -200,8 +200,8 @@
200200
(defparameter +modified-julian-date-offset+ -51604)
201201

202202
(defun transition-position (needle haystack)
203-
(declare (type integer needle)
204-
(type (simple-array integer (*)) haystack)
203+
(declare (type fixnum needle)
204+
(type (simple-array fixnum (*)) haystack)
205205
(optimize (speed 3)))
206206
(loop
207207
with start fixnum = 0
@@ -274,6 +274,7 @@ found."
274274
(values subzone
275275
transition-idx))))))
276276

277+
(declaim (ftype (function (t t &optional t) fixnum) %read-binary-integer))
277278
(defun %read-binary-integer (stream byte-count &optional (signed nil))
278279
"Read BYTE-COUNT bytes from the binary stream STREAM, and return an integer which is its representation in network byte order (MSB). If SIGNED is true, interprets the most significant bit as a sign indicator."
279280
(loop
@@ -323,15 +324,17 @@ found."
323324

324325
(defun %tz-read-transitions (inf count)
325326
(make-array count
327+
:element-type 'fixnum
326328
:initial-contents
327329
(loop for idx from 1 upto count
328330
collect (%read-binary-integer inf 4 t))))
329331

330332
(defun %tz-read-indexes (inf count)
331333
(make-array count
334+
:element-type 'fixnum
332335
:initial-contents
333336
(loop for idx from 1 upto count
334-
collect (%read-binary-integer inf 1))))
337+
collect (%read-binary-integer inf 1))))
335338

336339
(defun %tz-read-subzone (inf count)
337340
(loop for idx from 1 upto count
@@ -349,8 +352,8 @@ found."
349352
(loop for idx from 1 upto count
350353
collect (%read-binary-integer inf 4) into sec
351354
collect (%read-binary-integer inf 4) into adjustment
352-
finally (return (cons (make-array count :initial-contents sec)
353-
(make-array count :initial-contents adjustment))))))
355+
finally (return (cons (make-array count :element-type 'fixnum :initial-contents sec)
356+
(make-array count :element-type 'fixnum :initial-contents adjustment))))))
354357

355358
(defun %tz-read-abbrevs (inf length)
356359
(let ((a (make-array length :element-type '(unsigned-byte 8))))
@@ -1598,7 +1601,8 @@ The currently supported values in local-time are:
15981601
(passert (%list-length= 3 parts))
15991602
(date-fullyear (first parts))
16001603
(date-month (second parts))
1601-
(date-mday (third parts))))
1604+
(date-mday (third parts))
1605+
nil))
16021606
(date-fullyear (start-end)
16031607
(parse-integer-into start-end year))
16041608
(date-month (start-end)
@@ -1831,6 +1835,7 @@ See the documentation of FORMAT-TIMESTRING for the structure of FORMAT."
18311835
(:iso-week-year iso-year)
18321836
(:iso-week-number iso-week)
18331837
(:iso-week-day iso-weekday))))
1838+
(declare (fixnum val))
18341839
(cond
18351840
((atom fmt)
18361841
(princ val result))

test/comparison.lisp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(in-package #:local-time.test)
22

3-
(defsuite* (comparison :in simple))
4-
53
(defmacro defcmptest (comparator-name &body args)
64
`(deftest ,(symbolicate 'test/simple/comparison/ comparator-name) ()
75
(flet ((make (day &optional (sec 0) (nsec 0))

test/formatting.lisp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(in-package #:local-time.test)
22

3-
(defsuite* (formatting :in test))
4-
53
(deftest test/formatting/format-timestring/1 ()
64
(let ((*default-timezone* local-time:+utc-zone+)
75
(test-timestamp (encode-timestamp 1000 2 3 4 5 6 2008 :offset 0)))

test/package.lisp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
(cl:in-package :cl-user)
22

3-
(defpackage :local-time.test
4-
(:use :alexandria
5-
:common-lisp
6-
:hu.dwim.stefil
7-
:local-time))
3+
(fiasco:define-test-package #:local-time.test
4+
(:use #:common-lisp
5+
#:alexandria
6+
#:fiasco
7+
#:local-time))
88

9-
(in-package :local-time.test)
9+
(in-package #:local-time.test)
1010

11-
(defsuite* (test :in root-suite) ()
12-
(local-time::reread-timezone-repository)
13-
(run-child-tests))
11+
(local-time::reread-timezone-repository)

test/parsing.lisp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(in-package #:local-time.test)
22

3-
(defsuite* (parsing :in test))
4-
53
(deftest test/parsing/parse-format-consistency/range (&key (start-day -100000) (end-day 100000))
64
(declare (optimize debug))
75
(without-test-progress-printing

test/simple.lisp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
(in-package #:local-time.test)
22

3-
(defsuite* (simple :in test))
4-
53
(eval-when (:compile-toplevel :load-toplevel :execute)
64
(local-time::define-timezone eastern-tz
75
(merge-pathnames #p"US/Eastern" local-time::*default-timezone-repository-path*))
@@ -101,7 +99,7 @@
10199
(let ((a (parse-timestring "2006-01-01T00:00:00"))
102100
(b (parse-timestring "2001-01-02T00:00:00")))
103101
(is (= 4 (timestamp-whole-year-difference a b))))
104-
102+
105103
(let* ((local-time::*default-timezone* amsterdam-tz)
106104
(a (parse-timestring "1978-10-01")))
107105
(is (= 0 (timestamp-whole-year-difference a a)))))

test/timezone.lisp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
(in-package #:local-time.test)
22

3-
(defsuite* (timezone :in test))
43
(eval-when (:compile-toplevel :load-toplevel :execute)
54
(local-time::define-timezone eastern-tz
65
(merge-pathnames #p"EST5EDT" local-time::*default-timezone-repository-path*))
@@ -52,7 +51,7 @@
5251
(dolist (case cases)
5352
(destructuring-bind (needle haystack want)
5453
case
55-
(let ((got (local-time::transition-position needle haystack)))
54+
(let ((got (local-time::transition-position needle (coerce haystack '(simple-array fixnum (*))))))
5655
(is (= got want)
5756
"(transition-position ~a ~a) got ~a, want ~a"
5857
needle haystack got want))))))
@@ -73,7 +72,7 @@
7372
((2008 11 2 6 1) (2008 11 2 1 1))
7473
((2008 11 2 6 59) (2008 11 2 1 59)))
7574
(,cet-tz
76-
;; Spring forward
75+
;; Spring forward
7776
((2023 3 26 0 59) (2023 3 26 1 59))
7877
((2023 3 26 1 0) (2023 3 26 3 0))
7978
((2023 3 26 1 1) (2023 3 26 3 1))))
@@ -118,13 +117,13 @@ is expected instead.")
118117
1 6)) ;min, ..., year and reversed year, ..., min
119118
(second test-case)))))))
120119

121-
(deftest test/timzone/formatting ()
120+
(deftest test/timezone/formatting ()
122121
;; Zone Asia/Kolkata has positive fractional hour offset;
123122
;; zone Portugal has a negative fractional hour offset (in 1901).
124-
(is (equal (format-timestring t (encode-timestamp 0 0 0 0 1 1 2000 :offset 0)
123+
(is (equal (format-timestring nil (encode-timestamp 0 0 0 0 1 1 2000 :offset 0)
125124
:timezone ist)
126125
"2000-01-01T05:30:00.000000+05:30"))
127-
(is (equal (format-timestring t (encode-timestamp 0 0 0 0 5 12 1901 :offset 0)
126+
(is (equal (format-timestring nil (encode-timestamp 0 0 0 0 5 12 1901 :offset 0)
128127
:timezone portugal)
129128
"1901-12-04T23:23:15.000000-00:37")))
130129

@@ -264,4 +263,3 @@ is expected instead.")
264263
"Etc/Greenwich"
265264
(local-time:zone-name
266265
(caar (local-time:timezones-matching-subzone "GMT" (unix-to-timestamp 1585906626)))))))
267-

0 commit comments

Comments
 (0)