# zig test: when \-ofmt=c, default to \`zig run\` as test exec · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/e02caa7e2909c0ae7f7e8ea1378d78e0469b9ff8)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: e02caa7e2909c0ae7f7e8ea1378d78e0469b9ff8

Requested commit: e02caa7e2909c0ae7f7e8ea1378d78e0469b9ff8

Commit: e02caa7e2909c0ae7f7e8ea1378d78e0469b9ff8

Tree: 93bad2e6c3111bdc47b205a462585d30c79863dc

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
zig test: when -ofmt=c, default to `zig run` as test exec

Previously when running `zig test` with the C backend, it would return
`error.InvalidExe` because it would try to run the C code source file as
a binary. Now, by default, it will try to run it with
`zig run -lc foo.c` and this can be overridden with the standard
`--test-cmd` flags.

```

## Parents

- [6504c57176a2a7def07c975af693940fe351bb19](https://git.cafe/gitcafe/zig/commit/6504c57176a2a7def07c975af693940fe351bb19?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/e02caa7e2909c0ae7f7e8ea1378d78e0469b9ff8?format=markdown)
