add failure exit to test.sh
[mala.git] / tests / test-mala_stdmodule.c
blob608c3f1a19782bced4a4616fa6e51b308dbe6531
1 /*
2 test-mala_stdmodule.c - MaLa stdandard module test suite
4 Copyright (C) 2004, Christian Thaeter <chth@gmx.net>
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License version 2 as
8 published by the Free Software Foundation.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, contact me.
19 #include <assert.h>
20 #include <stdio.h>
21 #include <stdlib.h>
22 #include "mala.h"
23 #include "std.h"
25 mala_actioninit my_actions[] =
27 MALA_SUBSTITUTE_PARSER("--test","HEY_TEST_SUCCEEDED"),
28 MALA_PARSER_BRIEF("--test","brief explanation of test"),
29 MALA_PARSER_HELP("--test",("--PRINTL","long help for test")),
31 MALA_EXPAND_PARSER("--testtwo",("HEY", "TEST","SUCCEEDED")),
32 MALA_PARSER_BRIEF("--testtwo","brief explanation if testtwo"),
33 MALA_PARSER_HELP("--testtwo",("--PRINTL","long help for testtwo")),
35 MALA_ACTIONS_END
38 int
39 main(int argc, char * argv[])
41 MalaEngine my_engine;
43 (void) argc;
44 (void) argv;
46 my_engine = mala_engine_new ();
47 mala_module_std_init (my_engine);
48 mala_engine_actions_register (my_engine, my_actions);
49 mala_engine_ppexpand_define (my_engine, "--COMMANDLINE", argc - 1, argv + 1);
50 mala_engine_pushback_word (my_engine, "--COMMANDLINE");
51 //mala_engine_pushback_word (my_engine, "argument");
52 mala_engine_run (my_engine);
54 mala_engine_dumpargs (my_engine, "arg: ", "\n");
55 mala_engine_dumpprogram (my_engine, "prg: ", "\n");
57 printf ("variable: %s\n", getenv ("variable"));
58 printf ("negated: %d\n", mala_engine_negated (my_engine));
59 printf ("state: %d\n", mala_engine_state_get (my_engine));
61 mala_engine_free (my_engine);
62 return 0;
68 // Local Variables:
69 // mode: C
70 // c-file-style: "gnu"
71 // End:
72 // arch-tag: 56bcc0c2-d247-4a47-95dc-a460f26a444b
73 // end_of_file