From d07ff0ebc3697a9b2f7a0ed423051dd0e53933c5 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 27 Jun 2013 06:53:16 -0700 Subject: [PATCH] scribble: add tests for `traverse-element' and `traverse-block' original commit: d2ec0bf5cc259538bbad06752f65fe92dd885ff6 --- .../tests/scribble/docs/traverse.scrbl | 41 +++++++++++++++++++ .../tests/scribble/docs/traverse.txt | 11 +++++ 2 files changed, 52 insertions(+) create mode 100644 pkgs/racket-pkgs/racket-test/tests/scribble/docs/traverse.scrbl create mode 100644 pkgs/racket-pkgs/racket-test/tests/scribble/docs/traverse.txt diff --git a/pkgs/racket-pkgs/racket-test/tests/scribble/docs/traverse.scrbl b/pkgs/racket-pkgs/racket-test/tests/scribble/docs/traverse.scrbl new file mode 100644 index 00000000..f5e8bf48 --- /dev/null +++ b/pkgs/racket-pkgs/racket-test/tests/scribble/docs/traverse.scrbl @@ -0,0 +1,41 @@ +#lang scribble/base +@(require scribble/core) + +@(traverse-element + (lambda (get set) + ;; Not delayed, and so result is "not ready, yet" + (get 'glossary "not ready, yet"))) + +@(traverse-element + (lambda (get set) + ;; Delayed until second traversal: + (lambda (get set) + (get 'glossary "BROKEN")))) + +@; Same thing, but with blocks: + +@(traverse-block + (lambda (get set) + ;; Not delayed: + (para "The glossary is " + (get 'glossary "not ready, yet")))) + +@(traverse-block + (lambda (get set) + ;; Delayed: + (lambda (get set) + (para "The glossary is " + (get 'glossary "BROKEN"))))) + +@(traverse-block + (lambda (get set) + ;; Adding a `delayed-block' doesn't delay: + (traverse-block + (lambda (get set) + (para "The glossary is " + (get 'glossary "not ready, yet")))))) + +@(traverse-block + (lambda (get set) + (set 'glossary "ready") + (para "Here is the glossary."))) diff --git a/pkgs/racket-pkgs/racket-test/tests/scribble/docs/traverse.txt b/pkgs/racket-pkgs/racket-test/tests/scribble/docs/traverse.txt new file mode 100644 index 00000000..06ca4e03 --- /dev/null +++ b/pkgs/racket-pkgs/racket-test/tests/scribble/docs/traverse.txt @@ -0,0 +1,11 @@ +not ready, yet + +ready + +The glossary is not ready, yet + +The glossary is ready + +The glossary is not ready, yet + +Here is the glossary.