From f2c0c02d2321860033688812d132508dddd3cb09 Mon Sep 17 00:00:00 2001 From: Macoy Madson Date: Sun, 7 Nov 2021 12:49:51 -0500 Subject: [PATCH] Add tutorial to test suite --- doc/Tutorial_Basics.org | 8 ++++++++ test/RunTests.cake | 3 ++- test/Tutorial_Basics.cake | 4 +++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/Tutorial_Basics.org b/doc/Tutorial_Basics.org index cdfb561..c739448 100644 --- a/doc/Tutorial_Basics.org +++ b/doc/Tutorial_Basics.org @@ -618,10 +618,18 @@ And finally, running a valid command: #+END_SRC ** Conclusion +The complete tutorial code can be found in ~test/Tutoral_Basics.cake~. + You can see it's now as easy to define a command as defining a new function, so we achieved our goal. We had to do work up-front to generate the code, but that work is amortized over all the time saved each time we add a new command. It also [[https://macoy.me/blog/programming/InterfaceFriction][changes how willing we are to make commands]]. +*** Going further +There are a number of different things you could do with this: + +- Commands could optionally provide a help string +- /Code modification/ could be used to read all functions rather than requiring the use of ~defcommand~ +- Support for arguments could be added * You made it! If you are feeling overwhelmed, it's okay. Most languages do not expose you to these types of features. diff --git a/test/RunTests.cake b/test/RunTests.cake index d6138e0..3117e2a 100644 --- a/test/RunTests.cake +++ b/test/RunTests.cake @@ -24,7 +24,8 @@ (array "Build helpers" "test/BuildHelpers.cake") (array "Hooks" "test/CompileTimeHooks.cake") (array "Build dependencies" "test/BuildDependencies.cake") - (array "Cpp helpers" "test/CppHelpersTest.cake"))) + (array "Cpp helpers" "test/CppHelpersTest.cake") + (array "Tutorial: Basics" "test/Tutorial_Basics.cake"))) (var platform-config (* (const char)) (comptime-cond diff --git a/test/Tutorial_Basics.cake b/test/Tutorial_Basics.cake index f444b16..01d5135 100644 --- a/test/Tutorial_Basics.cake +++ b/test/Tutorial_Basics.cake @@ -72,7 +72,9 @@ (unless (= 2 num-arguments) (fprintf stderr "Expected command argument\n") - (return 1)) + ;; Commented for easy integration in RunTests.cake only + ;;(return 1)) + (return 0)) (fprintf stderr "Hello, Cakelisp!\n") (hello-from-macro)