hkoba / yatt_lite

YATT::Lite - Template with "use strict"
Other
5 stars 0 forks source link

Testing aid: `$factory->invoke_sub_in($loc, $args, $sub)` #196

Open hkoba opened 4 years ago

hkoba commented 4 years ago

To write session related tests for yatt, we need to call entity functions like &yatt:session(); (or it's equivalent $entns->entity_session()) from them. Unfortunately, entity functions are usable only when written in *.yatt, *.ydo or action. And adapting to write such files is normally not a simple task for Perl programmers even who are already good at writing *.t.

So, let's add $factory->invoke_sub_in($location, $args, $sub), which prepares same runtime environment of Web and invoke the $sub. The $sub is invoked like $sub->($dirhandler, $connection).