Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- procedure SayHelloWorld(ctx: PTmplContext; var output: PChar;
- arg_count : longint; var args : PChar); cdecl;
- const
- msg = 'Hello World';
- begin
- output := template_malloc (Length (msg) + 1);
- template_strcpy(output, msg);
- end;
- procedure TlibtmplTest.testRegisterSimple;
- var
- tmpl : PTmplContext;
- output : Pchar;
- begin
- tmpl := template_init;
- template_register_simple(tmpl, 'say_hello', @SayHelloWorld);
- template_parse_string(tmpl, '<!--#say_hello-->', output);
- AssertEquals('Register simple', 'Hello World', output);
- template_free_output(output);
- template_destroy(tmpl);
- end;
Add Comment
Please, Sign In to add comment