Skip to content

Commit d40d54c

Browse files
author
Stanislav Kholmanskikh
committed
doc: test-writing-guidelines: fixed the C test example
This example had some typos and other basic mistakes that prevented it from being built. Fixed it. Signed-off-by: Stanislav Kholmanskikh <[email protected]>
1 parent 24c3e60 commit d40d54c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

doc/test-writing-guidelines.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ Let's start with an example, following code is a simple test for a getenv().
218218
*/
219219

220220
#include "test.h"
221+
#include "usctest.h"
221222

222223
char *TCID = "getenv01";
223224
int TST_TOTAL = 2;
@@ -236,7 +237,7 @@ static void test(void)
236237
{
237238
char *ret;
238239

239-
ret = getenv(TEST_EVN);
240+
ret = getenv(TEST_ENV);
240241

241242
if (ret) {
242243
if (!strcmp(ret, TEST_ENV_VAL))
@@ -254,15 +255,15 @@ static void test(void)
254255
if (ret)
255256
tst_resm(TFAIL, "getenv(" TEST_NE_ENV ") = '%s'", ret);
256257
else
257-
tst_resm(TPASS, "getenv(" TEST_NE_ENV ")" = NULL);
258+
tst_resm(TPASS, "getenv(" TEST_NE_ENV ") = NULL");
258259
}
259260

260261
int main(int argc, char *argv[])
261262
{
262263
const char *msg;
263264
int lc;
264265

265-
if ((msg = parse_opts(argc, argv, NULL, NULL))
266+
if ((msg = parse_opts(argc, argv, NULL, NULL)))
266267
tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);
267268

268269
setup();

0 commit comments

Comments
 (0)