From 45e34eb4fd3728362ea8ad4ed1d59972b731f688 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Wed, 4 Oct 2023 07:31:35 +0200 Subject: Improve API and add tests --- tests/example.scm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tests/example.scm (limited to 'tests') diff --git a/tests/example.scm b/tests/example.scm new file mode 100644 index 0000000..5d47ef6 --- /dev/null +++ b/tests/example.scm @@ -0,0 +1,30 @@ +(define-module (tests atom) + #:use-module (src dates) + #:use-module (srfi srfi-64) + #:use-module ((src atom) #:prefix atom:)) + +(test-begin "Atom feed") + +(define me (atom:person "Ekaitz" + #:email "ekaitz@elenq.tech" + #:uri "https://elenq.tech")) + +(define feed + (atom:feed #:title "Mi feed" + #:subtitle "Este es mi feed" + #:uri "https://feed.elenq.tech" + #:entries (list + (atom:entry #:title "first entry" + #:published (string/ISO->date "2023-03-01") + #:authors (list me) + #:summary-html '(p "Este es el resumen") + #:content-html '(p "Este es el contenido") + #:categories (list "una" "dos" "tres") + #:media (list))))) + ;; TODO: Test media (reads file) + +(let ((atom-feed (with-output-to-string (lambda () (atom:render feed))))) + (test-assert (string=? atom-feed + "https://feed.elenq.techMi feed2023-03-01T00:00:00+0100Este es mi feedhttps://feed.elenq.tech/first-entryfirst entry2023-03-01T00:00:00+01002023-03-01T00:00:00+0100Ekaitzhttps://elenq.techekaitz@elenq.tech

Este es el resumen

Este es el contenido

"))) + +(test-end "Atom feed") -- cgit v1.2.3