From 886ae437fee6a674f7b2757062f1b8a91275457a Mon Sep 17 00:00:00 2001 From: Sacha Chua Date: Fri, 8 Oct 2021 01:58:03 -0400 Subject: Add talk pages for 2021 --- 2021/talks/test.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 2021/talks/test.md (limited to '2021/talks/test.md') diff --git a/2021/talks/test.md b/2021/talks/test.md new file mode 100644 index 00000000..9766b3b6 --- /dev/null +++ b/2021/talks/test.md @@ -0,0 +1,49 @@ +[[!meta title="Test blocks"]] +[[!meta copyright="Copyright © 2021 Eduardo Ochs"]] +[[!inline pages="internal(2021/info/test-nav)" raw="yes"]] + + + + +# Test blocks +Eduardo Ochs + +In this presentation I will show an idea that feels completely obvious +once we see it, but that only occured to me after after using Emacs +and eev as my main interface to the computer for more than 20 years. +Take any interpreted language that supports multi-line comments, and +whose interpreter can be run in an Emacs buffer - for example Lua, +Haskell, Python, or Julia; let's say just "Lua" from here on for +simplicity. So: suppose that we have a Lua script that we wrote, that +is called "foo.lua" and that defines lots of functions and defines the +classes Bar and Bletch. We can put after the definition of the class +Bar a multi-line comment that contains an eepitch block that when +executed starts a Lua interpreter, loads the script foo.lua (by +running 'dofile "foo.lua"'), and then has several tests for that class +and its methods; and we can put another block with tests like that +after the class Bletch, and other blocks after some functions. Eepitch +allows sending these tests line by line to the Lua interpreter by +typing on each line that we want to send, and this lets us create +tests that are very easy to understand even without writing comments; +this gives us a very quick way to document code by executable tests, +that is super-great for experimental code that is still going to +change a lot before running the risk of being read by other people. + +These multi-line comments with eepitch blocks that run an interpreter +and make it load the current file are called "test blocks". The +command \`M-x eeit' inserts a test block at point, using the major mode +to decide the right syntax to use for the multi-line comments and for +the "dofile". We can configure the syntax of the test blocks for the +current major mode by running \`M-x find-eeit-links'; this can also be +used to add support for test blocks to more languages (or, more +precisely: to more major modes). + +Cheers =), + Eduardo Ochs + + + + +[[!inline pages="internal(2021/info/test-schedule)" raw="yes"]] + +[[!inline pages="internal(2021/info/test-nav)" raw="yes"]] -- cgit v1.2.3