Tinderbox Meetup SUNDAY August 27

Time: SUNDAY, August 27, 2023, 12:00 noon Eastern Time (US and Canada)

9 AM Pacific Time
Noon Eastern time
1300 São Paulo
1600 UTC
1700 London
1800 Paris
2130 Delhi

Zoom link for the meetup: Launch Meeting - Zoom

1 Like

Today we discussed test-driven development inside Tinderbox, focusing on an interesting Michael Becker problem from this week:

Assume that the text of a note is marked up with brief passages highlighted in blue. “Explode” the note, creating new notes whose titles are the highlighted passages, and whose text is the text up to the next highlighted passage.

We develop a small library of functions to help do this, with a suite of tests to confirm that the library is doing what we expect.

By taking very small steps, we can avoid situations where something is wrong and we don’t know where to look!

Tinderbox TDD.tbx (341.6 KB)

Video: Tinderbox Meetup: Test Driven Tinderbox on Vimeo

Chat: chat.txt (3.4 KB)

4 Likes

Hello Mark,

just a minor question:

function Expect(test:string) {
   if (!$Checked) {
      return;
   }
   testPrepare();
   $Checked = eval(this,test);
}

Why did you add “this” to the eval() function here?

The unnecessary this is a leftover of a previous design, in which tests were invoked by another note — much as “summarize” checks the results of all the tests. You can omit it.

To footnote the last, eval() has _two arguments, one of which is optional: eval([item], expressionStr).

Using this for the first is harmless in terms of explicitly (re-)stating the default context.

@webline, if the linked description is ambiguous in this regard, do please say as clarification is generally possible,

Actually, I think the usage makes sense to me. Why? This is a utility function general use, and _generally, the (note) context of a function is the calling note. Which is the case … until it isn’t, the latter occurring as—unexpectedly—the context is different. Pertinent here, in edge cases, is to review this vs current.

Pedantically, eval(this, ...) and eval(...)are normally the same, but sometimes it does no harm to be declarative of intent.

HTH :slight_smile:

1 Like

As I’ve had some questions directly from users as to how to 'read the code of the ‘Explode Highlights’ library I’ve made a map to show the run of things. It is designed to be read alongside the ‘Tinderbox TDD.tbx’ file.

File: TTD-library-explained1.tbx (386.9 KB)
(annoyingly, on load the map seems to scroll all the map content off screen top-left, so you may need to scroll the map to see contents like below)

A grab giving some idea of the content (map as saved—see note above)):

1 Like