Skip to content

Commit 90577d4

Browse files
committed
Skip 12 discover tests on Windows (use Unix shell commands)
Discover integration tests use system("rm -rf && mkdir -p && echo >") which are Unix shell commands. These tests are properly skipped on Windows with SKIP_UNIX_SHELL macro. The remaining 4 Windows test failures (store_dump, cli_find, ui_config x2) need individual fixes. TODO: Port discover test helpers to use C file operations.
1 parent 18c23d4 commit 90577d4

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

tests/test_discover.c

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,20 @@
44
* RED phase: Tests define expected filtering behavior for the discover module.
55
*/
66
#include "test_framework.h"
7+
#include "../src/foundation/compat.h"
78
#include "discover/discover.h"
9+
#ifndef _WIN32
810
#include <sys/stat.h>
11+
#endif
12+
13+
/* Discover integration tests use system("rm -rf && mkdir -p && echo >")
14+
* which are Unix shell commands not available on Windows.
15+
* TODO: Port to C file operations for full Windows support. */
16+
#ifdef _WIN32
17+
#define SKIP_UNIX_SHELL SKIP("uses Unix shell — Windows port pending")
18+
#else
19+
#define SKIP_UNIX_SHELL ((void)0)
20+
#endif
921

1022
/* ── Directory skip (always skipped) ───────────────────────────── */
1123

@@ -254,6 +266,7 @@ TEST(pattern_dts_full) {
254266
/* ── File discovery (integration) ──────────────────────────────── */
255267

256268
TEST(discover_simple) {
269+
SKIP_UNIX_SHELL;
257270
/* Create a temp directory with a few files */
258271
const char *base = "/tmp/test_discover_simple";
259272
char cmd[512];
@@ -291,6 +304,7 @@ TEST(discover_simple) {
291304
}
292305

293306
TEST(discover_skips_git_dir) {
307+
SKIP_UNIX_SHELL;
294308
const char *base = "/tmp/test_discover_gitdir";
295309
char cmd[512];
296310
snprintf(cmd, sizeof(cmd),
@@ -315,6 +329,7 @@ TEST(discover_skips_git_dir) {
315329
}
316330

317331
TEST(discover_with_gitignore) {
332+
SKIP_UNIX_SHELL;
318333
const char *base = "/tmp/test_discover_gitignore";
319334
char cmd[512];
320335
snprintf(cmd, sizeof(cmd),
@@ -342,6 +357,7 @@ TEST(discover_with_gitignore) {
342357
}
343358

344359
TEST(discover_max_file_size) {
360+
SKIP_UNIX_SHELL;
345361
const char *base = "/tmp/test_discover_maxsize";
346362
char cmd[512];
347363
snprintf(cmd, sizeof(cmd),
@@ -389,6 +405,7 @@ TEST(discover_free_null) {
389405

390406
/* --- Ported from discover_test.go: TestDiscoverSkipsWorktrees --- */
391407
TEST(discover_skips_worktrees) {
408+
SKIP_UNIX_SHELL;
392409
const char *base = "/tmp/test_discover_worktrees";
393410
char cmd[512];
394411
snprintf(cmd, sizeof(cmd),
@@ -423,6 +440,7 @@ TEST(discover_skips_worktrees) {
423440

424441
/* --- Ported from discover_test.go: TestCBMIgnoreBasic --- */
425442
TEST(discover_cbmignore) {
443+
SKIP_UNIX_SHELL;
426444
const char *base = "/tmp/test_discover_cbmignore";
427445
char cmd[512];
428446
snprintf(cmd, sizeof(cmd),
@@ -451,6 +469,7 @@ TEST(discover_cbmignore) {
451469

452470
/* --- Ported from discover_test.go: TestCBMIgnoreStacksOnGitignore --- */
453471
TEST(discover_cbmignore_stacks) {
472+
SKIP_UNIX_SHELL;
454473
const char *base = "/tmp/test_discover_cbmignore_stack";
455474
char cmd[512];
456475
snprintf(cmd, sizeof(cmd),
@@ -486,6 +505,7 @@ TEST(discover_cbmignore_stacks) {
486505

487506
/* --- Ported from discover_test.go: TestSymlinkedFilesSkipped --- */
488507
TEST(discover_symlink_skipped) {
508+
SKIP_UNIX_SHELL;
489509
const char *base = "/tmp/test_discover_symlink";
490510
char cmd[512];
491511
snprintf(cmd, sizeof(cmd),
@@ -521,6 +541,7 @@ TEST(discover_symlink_skipped) {
521541

522542
/* --- Ported from discover_test.go: TestNewIgnorePatterns --- */
523543
TEST(discover_new_ignore_patterns) {
544+
SKIP_UNIX_SHELL;
524545
const char *base = "/tmp/test_discover_newignore";
525546
/* Create dirs that should be in IGNORE_PATTERNS */
526547
const char *dirs[] = {".next", ".terraform", "zig-cache", ".cargo", "elm-stuff", "bazel-out"};
@@ -555,6 +576,7 @@ TEST(discover_new_ignore_patterns) {
555576

556577
/* --- Ported from discover_test.go: TestGenericDirsNotIgnoredInFullMode --- */
557578
TEST(discover_generic_dirs_full_mode) {
579+
SKIP_UNIX_SHELL;
558580
const char *base = "/tmp/test_discover_generic_full";
559581
char cmd[512];
560582
snprintf(cmd, sizeof(cmd),
@@ -582,6 +604,7 @@ TEST(discover_generic_dirs_full_mode) {
582604

583605
/* --- Ported from discover_test.go: TestGenericDirsIgnoredInFastMode --- */
584606
TEST(discover_generic_dirs_fast_mode) {
607+
SKIP_UNIX_SHELL;
585608
const char *base = "/tmp/test_discover_generic_fast";
586609
char cmd[512];
587610
snprintf(cmd, sizeof(cmd),
@@ -609,6 +632,7 @@ TEST(discover_generic_dirs_fast_mode) {
609632

610633
/* --- Ported from discover_test.go: TestCBMIgnoreWithoutGitRepo --- */
611634
TEST(discover_cbmignore_no_git) {
635+
SKIP_UNIX_SHELL;
612636
const char *base = "/tmp/test_discover_cbmignore_nogit";
613637
char cmd[512];
614638
/* No .git directory — .cbmignore should still work */

0 commit comments

Comments
 (0)