diff --git a/CHANGELOG b/CHANGELOG index 1ff41024f55626b3103456c1ceb41f565b410da7..cc0efdbd1f69d5f7b1f9e23a87e53dd5e2acaf08 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,12 @@ 2020-07-22 David Byers <david.byers@liu.se> + Fix test cases: + * test/olctest.el: Use keyword args in test cases. + + Clean up for melpa: + * olc.el: Use #' instead of ' in a few places. Enable lexical + binding. + Rename some functions: * olc.el (olc-shorten-compound): Renamed from olc-shorten-geo to better match Google's terminology in their plus codes api. diff --git a/olc.el b/olc.el index 694e43e7db862e2379d088c1f6a74892250b2a01..552f2f66d7552c4899cb4f2958cc6633c8d64a0e 100644 --- a/olc.el +++ b/olc.el @@ -1,6 +1,4 @@ -;; -*-coding: utf-8;-*- - -;;; olc.el --- Open location code library +;;; olc.el --- Open location code library -*-lexical-binding: t;-*- ;; Copyright (C) 2020 David Byers ;; @@ -350,7 +348,7 @@ values cannot (legally) be encoded to the selected length." (nconc (make-list (max 0 (- 8 len)) ?0) (when truncate (list ?+))))) - (apply 'string code))) + (apply #'string code))) (defun olc-decode (code) @@ -476,7 +474,7 @@ faster. (lon . ,(olc-area-lon area)) (zoom . ,zoom) (format . "json")) - :parser 'json-read + :parser #'json-read :sync t))) (tmp-code (when resp @@ -576,7 +574,7 @@ full open location code." :params `((q . ,reference) (format . "json") (limit . 1)) - :parser 'json-read + :parser #'json-read :sync t))) (when (eq 200 (request-response-status-code resp)) (let ((data (elt (request-response-data resp) 0))) diff --git a/test/olctest.el b/test/olctest.el index e04234583d5613660745011a5356d7fd324dce9e..1a0a2fbca4c85d9490a1b4969a522476f31604ff 100644 --- a/test/olctest.el +++ b/test/olctest.el @@ -1,4 +1,4 @@ -;;;; -*-coding: utf-8;-*- +;;;; -*-coding: utf-8; lexical-binding: t;-*- ;;;; ;;;; Copyright (C) 2020 David Byers ;;;; @@ -112,7 +112,7 @@ (olctest-run-csv ("encoding.csv" case) (let ((code (olc-encode (alist-get 'latitude case) (alist-get 'longitude case) - (alist-get 'length case)))) + :len (alist-get 'length case)))) (unless (string= code (alist-get 'expected case)) (olctest-record-failure case (alist-get 'expected case) code))))) @@ -190,14 +190,14 @@ (lon (alist-get 'lon case)) (len (alist-get 'len case)) (shortcode (alist-get 'exp case)) - (actual (olc-shorten fullcode lat lon len))) + (actual (olc-shorten fullcode lat lon :limit len))) (unless (string= actual shortcode) (olctest-record-failure case shortcode actual))))) (defun olctest-run-all () "Run all tests." - (and (olctest-decode)q + (and (olctest-decode) (olctest-encode) (olctest-shortcodes) (olctest-validity)