Lumiera  0.pre.03
»edit your freedom«
TextTemplate_test Class Reference

Description

Test:
verify a minimalistic text substitution engine with flexible data binding, used for tool integration and script generation
  • cover the core parsing and templating functionality, using a direct binding
  • demonstrate the default-binding for a data map
  • cover the binding to Lumiera's »External Tree Description«
See also
text-template.hpp
GnuplotGen_test

Definition at line 66 of file text-template-test.cpp.

Private Member Functions

virtual void run (Arg)
 
void simpeUsage ()
 
void verify_conditional ()
 
void verify_ETD_binding ()
 
void verify_instantiation ()
 
void verify_iteration ()
 
void verify_Map_binding ()
 
void verify_parsing ()
 

Member Function Documentation

◆ simpeUsage()

void simpeUsage ( )
inlineprivate
Test:
simple point-and-shot usage...

Definition at line 85 of file text-template-test.cpp.

References TextTemplate::apply().

+ Here is the call graph for this function:

◆ verify_parsing()

void verify_parsing ( )
inlineprivate
Test:
parsing of tag markup and compilation into a sequence of Action-codes
Note
the regular expression ACCEPT_FIELD is comprised of several alternatives and optional parts, which are marked by 5 sub-expressions
  • 1 ≙ an escaped field (which should not be processed)
  • 2 ≙ else token (which must be solitary)
  • 3 ≙ end token
  • 4 ≙ some logic token ("if" or "for")
  • 5 ≙ a key or key path

Definition at line 104 of file text-template-test.cpp.

◆ verify_instantiation()

void verify_instantiation ( )
inlineprivate
Test:
Compile a template and instantiate with various data bindings.

Definition at line 362 of file text-template-test.cpp.

◆ verify_conditional()

void verify_conditional ( )
inlineprivate
Test:
Segments of the text-template can be included conditionally, based on interpretation of a controlling key.

Definition at line 383 of file text-template-test.cpp.

◆ verify_iteration()

void verify_iteration ( )
inlineprivate
Test:
Segments of the text-template can be iterated...
  • there is a control-key to guide the iteration
  • how this key translates into nested data scopes is defined by the implementation of the data binding
  • for this test we use the Map-binding, which synthesises key prefixes and expects bindings for those decorated keys
  • typically, keys in inner scopes will shadow outer keys, as is demonstrated here with the "x" key at top level
  • loops and conditionals can be nested

Definition at line 422 of file text-template-test.cpp.

◆ verify_Map_binding()

void verify_Map_binding ( )
inlineprivate
Test:
build a data binding to a map-of-strings, and verify all the operations used internally by the text-template engine to navigate the data.

Definition at line 453 of file text-template-test.cpp.

◆ verify_ETD_binding()

void verify_ETD_binding ( )
inlineprivate
Test:
represent the same logical structure as in the preceding test, yet this time as a tree of GenNodes
  • value bindings are translated into attribute access
  • the iteration now requires an actually nested scope, holding a sequence of child nodes
  • each of these nodes constitutes a »data entity«
  • when accessing keys from within such a nested scope, attributes of enclosing scopes are visible, unless shadowed by local definition.

Definition at line 529 of file text-template-test.cpp.

+ Inheritance diagram for TextTemplate_test:
+ Collaboration diagram for TextTemplate_test:

The documentation for this class was generated from the following file: