diff options
Diffstat (limited to 'src/testing/testing_api_cmd_hello_world.c')
-rw-r--r-- | src/testing/testing_api_cmd_hello_world.c | 19 |
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 @@ | |||
29 | struct HelloWorldState | 29 | struct HelloWorldState |
30 | { | 30 | { |
31 | char *message; | 31 | char *message; |
32 | const char *birthLabel; | ||
32 | }; | 33 | }; |
33 | 34 | ||
34 | /** | 35 | /** |
@@ -43,7 +44,7 @@ hello_world_cleanup (void *cls, | |||
43 | { | 44 | { |
44 | struct HelloWorldState *hs = cls; | 45 | struct HelloWorldState *hs = cls; |
45 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 46 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
46 | "Cleaning up message %s", | 47 | "Cleaning up message %s\n", |
47 | hs->message); | 48 | hs->message); |
48 | } | 49 | } |
49 | 50 | ||
@@ -78,11 +79,17 @@ hello_world_run (void *cls, | |||
78 | struct GNUNET_TESTING_Interpreter *is) | 79 | struct GNUNET_TESTING_Interpreter *is) |
79 | { | 80 | { |
80 | struct HelloWorldState *hs = cls; | 81 | struct HelloWorldState *hs = cls; |
82 | const struct GNUNET_TESTING_Command *birth_cmd; | ||
83 | |||
84 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | ||
85 | "%s\n", | ||
86 | hs->message); | ||
87 | birth_cmd = GNUNET_TESTING_interpreter_lookup_command (hs->birthLabel); | ||
88 | GNUNET_TESTING_get_trait_what_am_i (birth_cmd, &hs->message); | ||
81 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 89 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
82 | "%s", | 90 | "Now I am a %s\n", |
83 | hs->message); | 91 | hs->message); |
84 | GNUNET_TESTING_get_trait_what_am_i (cmd, | 92 | GNUNET_TESTING_interpreter_next (is); |
85 | hs->message); | ||
86 | } | 93 | } |
87 | 94 | ||
88 | /** | 95 | /** |
@@ -94,12 +101,14 @@ hello_world_run (void *cls, | |||
94 | */ | 101 | */ |
95 | struct GNUNET_TESTING_Command | 102 | struct GNUNET_TESTING_Command |
96 | GNUNET_TESTING_cmd_hello_world (const char *label, | 103 | GNUNET_TESTING_cmd_hello_world (const char *label, |
104 | const char *birthLabel, | ||
97 | char *message) | 105 | char *message) |
98 | { | 106 | { |
99 | struct HelloWorldState *hs; | 107 | struct HelloWorldState *hs; |
100 | 108 | ||
101 | hs = GNUNET_new (struct HelloWorldState); | 109 | hs = GNUNET_new (struct HelloWorldState); |
102 | hs->message = "Hello World, I am nobody!"; | 110 | hs->message = "Hello World, I was nobody!"; |
111 | hs->birthLabel = birthLabel; | ||
103 | 112 | ||
104 | struct GNUNET_TESTING_Command cmd = { | 113 | struct GNUNET_TESTING_Command cmd = { |
105 | .cls = hs, | 114 | .cls = hs, |