Skip to content

'with test' links for _main instead of running test_* functions #11

Closed

Description

@ehartford

Current behavior

A file that contains only test_* functions does not run under with test. Instead, the linker fails looking for _main.

fn test_addition:
    assert(1 + 1 == 2)
Undefined symbols for architecture arm64:
  "_main", referenced from:
      <initial-undefines>
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: test build failed

Expected behavior

with test should discover and run test_* functions without requiring an explicit main, consistent with the language docs.

Repro

cat >/tmp/with_test_requires_main.w <<'END_SOURCE'
fn test_addition:
    assert(1 + 1 == 2)
END_SOURCE
with test /tmp/with_test_requires_main.w

Impact

This forced the Crux bootstrap repo to wrap every test file in a manual main, which defeats the documented test workflow and adds boilerplate to every test source.

Activity

  1. added
    bug
    on Mar 20, 2026
  2. added a commit that references this issue on Jun 8, 2026
    9082020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions