diff options
Diffstat (limited to 'hello')
-rw-r--r-- | hello/hello-test.scm | 20 | ||||
-rwxr-xr-x | hello/hello.scm | 16 |
2 files changed, 36 insertions, 0 deletions
diff --git a/hello/hello-test.scm b/hello/hello-test.scm new file mode 100644 index 0000000..1865112 --- /dev/null +++ b/hello/hello-test.scm @@ -0,0 +1,20 @@ +(use-modules (srfi srfi-64) + (hello)) + +(test-begin "harness") + + +(test-equal "test-hello" + "hello world\n" + (hi)) + +(test-equal "test-hello-bd" + "hello bd\n" + (hi "bd")) + +(test-equal "test-hello-db" + "hello db\n" + (hi "db")) + + +(test-end "harness") diff --git a/hello/hello.scm b/hello/hello.scm new file mode 100755 index 0000000..bf8dfa0 --- /dev/null +++ b/hello/hello.scm @@ -0,0 +1,16 @@ +(define-module (hello)) + +(define GREETING_PREFIX "hello ") +(define GREETING_SUFFIX "\n") +(define DEFAULT_ADDRESSEE "world") + + +(define-public hi + (lambda* (#:optional name) + (string-append GREETING_PREFIX (addressee name) GREETING_SUFFIX))) + +(define addressee + (lambda (name) + (if name + name + DEFAULT_ADDRESSEE))) |