# stage2: improvements towards \`zig test\` · gitcafe/zig

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

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

Visibility: public

Requested revision: 7b8cb881df7e034a8626caabf355055ee81a0fef

Requested commit: 7b8cb881df7e034a8626caabf355055ee81a0fef

Commit: 7b8cb881df7e034a8626caabf355055ee81a0fef

Tree: e56858cd22ccf90217a49c51c7d8ff7df49ab0f3

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
stage2: improvements towards `zig test`

 * There is now a main_pkg in addition to root_pkg. They are usually the
   same. When using `zig test`, main_pkg is the user's source file and
   root_pkg has the test runner.
 * scanDecl no longer looks for test decls outside the package being
   tested. honoring `--test-filter` is still TODO.
 * test runner main function has a void return value rather than
   `anyerror!void`
 * Sema is improved to generate better AIR for for loops on slices.
 * Sema: fix incorrect capacity calculation in zirBoolBr
 * Sema: add compile errors for trying to use slice fields as an lvalue.
 * Sema: fix type coercion for error unions
 * Sema: fix analyzeVarRef generating garbage AIR
 * C codegen: fix renderValue for error unions with 0 bit payload
 * C codegen: implement function pointer calls
 * CLI: fix usage text

 Adds 4 new AIR instructions:

  * slice_len, slice_ptr: to get the ptr and len fields of a slice.
  * slice_elem_val, ptr_slice_elem_val: to get the element value of
    a slice, and a pointer to a slice.

AstGen gains a new functionality:

 * One of the unused flags of struct decls is now used to indicate
   structs that are known to have non-zero size based on the AST alone.

```

## Parents

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

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