From 8f425cd6f020b5082445be9547e9308be73c6adf Mon Sep 17 00:00:00 2001 From: md-arif-shaikh Date: Wed, 3 Apr 2024 09:02:01 +0530 Subject: [PATCH] add tests --- .github/workflows/emacs-test.yml | 23 +++++++++++++++++++++++ tzc-tests.el | 9 +++++++++ 2 files changed, 32 insertions(+) create mode 100644 .github/workflows/emacs-test.yml create mode 100644 tzc-tests.el diff --git a/.github/workflows/emacs-test.yml b/.github/workflows/emacs-test.yml new file mode 100644 index 0000000..0c3f08c --- /dev/null +++ b/.github/workflows/emacs-test.yml @@ -0,0 +1,23 @@ +name: Emacs Tests + +on: + push: + branches: + - main + pull_request: + branches: + - main + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install Emacs + run: sudo apt-get install emacs + + - name: Run tests + run: emacs --batch -l ert -l tzc-tests.el -f ert-run-tests-batch-and-exit diff --git a/tzc-tests.el b/tzc-tests.el new file mode 100644 index 0000000..f28f1b8 --- /dev/null +++ b/tzc-tests.el @@ -0,0 +1,9 @@ +(require 'ert) +(load-file "tzc.el") + +(ert-deftest tzc-test-get-offset-lisbon () + (should (equal (mapcar (lambda (date) (tzc--get-offset "Europe/Lisbon" date)) (list "2024-03-25" "2024-04-05")) (list "+0000" "+0100")))) + +(ert-deftest tzc-test-get-offset-los-angeles () + (should (equal (mapcar (lambda (date) (tzc--get-offset "America/Los_Angeles" date)) (list "2024-02-25" "2024-03-15")) (list "-0800" "-0700")))) +