Changeset 97c3c59 in mainline for uspace/app/nav/test/panel.c
- Timestamp:
- 2021-10-25T00:32:45Z (4 years ago)
- Branches:
- master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5bbb4453
- Parents:
- 01e9991
- git-author:
- Jiri Svoboda <jiri@…> (2021-10-19 19:48:40)
- git-committer:
- jxsvoboda <5887334+jxsvoboda@…> (2021-10-25 00:32:45)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nav/test/panel.c
r01e9991 r97c3c59 471 471 rv = remove(p); 472 472 PCUT_ASSERT_INT_EQUALS(0, rv); 473 473 474 free(fname); 475 } 476 477 /** When moving to parent directory from a subdir, we seek to the 478 * coresponding entry 479 */ 480 PCUT_TEST(read_dir_up) 481 { 482 panel_t *panel; 483 char buf[L_tmpnam]; 484 char *subdir_a; 485 char *subdir_b; 486 char *subdir_c; 487 char *p; 488 errno_t rc; 489 int rv; 490 491 /* Create name for temporary directory */ 492 p = tmpnam(buf); 493 PCUT_ASSERT_NOT_NULL(p); 494 495 /* Create temporary directory */ 496 rc = vfs_link_path(p, KIND_DIRECTORY, NULL); 497 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 498 499 /* Create some subdirectories */ 500 501 rv = asprintf(&subdir_a, "%s/%s", p, "a"); 502 PCUT_ASSERT_TRUE(rv >= 0); 503 rc = vfs_link_path(subdir_a, KIND_DIRECTORY, NULL); 504 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 505 506 rv = asprintf(&subdir_b, "%s/%s", p, "b"); 507 PCUT_ASSERT_TRUE(rv >= 0); 508 rc = vfs_link_path(subdir_b, KIND_DIRECTORY, NULL); 509 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 510 511 rv = asprintf(&subdir_c, "%s/%s", p, "c"); 512 PCUT_ASSERT_TRUE(rv >= 0); 513 rc = vfs_link_path(subdir_c, KIND_DIRECTORY, NULL); 514 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 515 516 rc = panel_create(NULL, true, &panel); 517 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 518 519 /* Start in subdirectory "b" */ 520 rc = panel_read_dir(panel, subdir_b); 521 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 522 523 /* Now go up (into p) */ 524 525 rc = panel_read_dir(panel, ".."); 526 PCUT_ASSERT_ERRNO_VAL(EOK, rc); 527 528 PCUT_ASSERT_NOT_NULL(panel->cursor); 529 PCUT_ASSERT_STR_EQUALS("b", panel->cursor->name); 530 531 panel_destroy(panel); 532 533 rv = remove(subdir_a); 534 PCUT_ASSERT_INT_EQUALS(0, rv); 535 536 rv = remove(subdir_b); 537 PCUT_ASSERT_INT_EQUALS(0, rv); 538 539 rv = remove(subdir_c); 540 PCUT_ASSERT_INT_EQUALS(0, rv); 541 542 rv = remove(p); 543 PCUT_ASSERT_INT_EQUALS(0, rv); 544 545 free(subdir_a); 546 free(subdir_b); 547 free(subdir_c); 474 548 } 475 549 … … 594 668 /* Add another entry */ 595 669 attr.name = "b"; 596 attr.size = 2;670 attr.size = 2; 597 671 rc = panel_entry_append(panel, &attr); 598 672 PCUT_ASSERT_ERRNO_VAL(EOK, rc);
Note:
See TracChangeset
for help on using the changeset viewer.