summaryrefslogtreecommitdiff
path: root/src/testing/testing_api_cmd_hello_world.c
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2021-03-15 10:45:45 +0100
committert3sserakt <t3ss@posteo.de>2021-03-15 10:45:45 +0100
commita550f7863bff0792c8972609869d409b77efc1dd (patch)
tree3e176423be8a3bdafb16d8891ebc3befc7fe3ffe /src/testing/testing_api_cmd_hello_world.c
parentb47586e76bc4f3c2c4ab6829028b5dd2f03e702d (diff)
- added hello world test with command style
Diffstat (limited to 'src/testing/testing_api_cmd_hello_world.c')
-rw-r--r--src/testing/testing_api_cmd_hello_world.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/testing/testing_api_cmd_hello_world.c b/src/testing/testing_api_cmd_hello_world.c
index 8aa4a2f1c..8c1d7353d 100644
--- a/src/testing/testing_api_cmd_hello_world.c
+++ b/src/testing/testing_api_cmd_hello_world.c
@@ -29,6 +29,7 @@
struct HelloWorldState
{
char *message;
+ const char *birthLabel;
};
/**
@@ -43,7 +44,7 @@ hello_world_cleanup (void *cls,
{
struct HelloWorldState *hs = cls;
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "Cleaning up message %s",
+ "Cleaning up message %s\n",
hs->message);
}
@@ -78,11 +79,17 @@ hello_world_run (void *cls,
struct GNUNET_TESTING_Interpreter *is)
{
struct HelloWorldState *hs = cls;
+ const struct GNUNET_TESTING_Command *birth_cmd;
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "%s\n",
+ hs->message);
+ birth_cmd = GNUNET_TESTING_interpreter_lookup_command (hs->birthLabel);
+ GNUNET_TESTING_get_trait_what_am_i (birth_cmd, &hs->message);
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- "%s",
+ "Now I am a %s\n",
hs->message);
- GNUNET_TESTING_get_trait_what_am_i (cmd,
- hs->message);
+ GNUNET_TESTING_interpreter_next (is);
}
/**
@@ -94,12 +101,14 @@ hello_world_run (void *cls,
*/
struct GNUNET_TESTING_Command
GNUNET_TESTING_cmd_hello_world (const char *label,
+ const char *birthLabel,
char *message)
{
struct HelloWorldState *hs;
hs = GNUNET_new (struct HelloWorldState);
- hs->message = "Hello World, I am nobody!";
+ hs->message = "Hello World, I was nobody!";
+ hs->birthLabel = birthLabel;
struct GNUNET_TESTING_Command cmd = {
.cls = hs,