aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2020-05-23 12:55:30 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2020-05-23 12:59:19 +0200
commit773e515c583a7707319459390f61a0fa1db06eea (patch)
tree85d760f570ccb56a69a2e3b8f01200a95576e186 /tests
parentRemove special case for first day in month view. (diff)
downloadcalp-773e515c583a7707319459390f61a0fa1db06eea.tar.gz
calp-773e515c583a7707319459390f61a0fa1db06eea.tar.xz
Add tests for with-replaced-attrs.
Diffstat (limited to 'tests')
-rw-r--r--tests/vcomponent-control.scm25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/vcomponent-control.scm b/tests/vcomponent-control.scm
new file mode 100644
index 00000000..318c4335
--- /dev/null
+++ b/tests/vcomponent-control.scm
@@ -0,0 +1,25 @@
+(((vcomponent control) with-replaced-attrs)
+ ((vcomponent) parse-calendar)
+ ((vcomponent base) attr))
+
+
+
+(define ev (call-with-input-string
+ "BEGIN:DUMMY
+KEY:value
+END:DUMMY"
+ parse-calendar))
+
+;; Test that temoraries are set and restored
+(test-equal "value" (attr ev 'KEY))
+(with-replaced-attrs (ev (KEY "other"))
+ (test-equal "other" (attr ev 'KEY)))
+(test-equal "value" (attr ev 'KEY))
+
+;; Test that they are restored on non-local exit
+(catch #t
+ (lambda ()
+ (with-replaced-attrs (ev (KEY "other"))
+ (throw 'any)))
+ (lambda _
+ (test-equal "value" (attr ev 'KEY))))