Browse Source

Add tutorial to test suite

macOS
Macoy Madson 2 years ago
parent
commit
f2c0c02d23
  1. 8
      doc/Tutorial_Basics.org
  2. 3
      test/RunTests.cake
  3. 4
      test/Tutorial_Basics.cake

8
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.

3
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

4
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)

Loading…
Cancel
Save