<commit_before># dex-tests


## test execution

Tests are executed in a docker container with bats, git, and some common shells.
Use the Makefile in our repository root to execute. The following runs all tests

```
cd /path/to/dex.git
make tests
```

Limit which tests to run by exporting or passing `TEST`, e.g.
```
make TEST=07-run.bats tests
```

Some tests make remote network calls. This can slow things down, esp.
on a system with an unresponsive resolver. Skip these by exporting or passing `SKIP_NETWORK_TEST`, e.g.

```
export SKIP_NETWORK_TEST=true
make tests
```


## test development

TBD

### rebuild the test dockerfile

```
cd /path/to/dex.git
make clean
make tests
```

### updating the help.txt fixture

```
cd /path/to/dex.git
./dex.sh > tests/fixtures/help.txt
```<commit_msg>port tests/README.md<commit_after># Testing Dex


## test execution

Use the root `Makefile` to build and run tests in a container preloaded with
with [bats](https://github.com/sstephenson/bats), git, and common shells.

```
cd /path/to/dex.git
make tests
```

Limit which tests to run by exporting or passing `TEST`, e.g.
```
make TEST=07-run.bats tests
```

Some tests make remote network calls. This can slow things down, esp.
on a system with an unresponsive resolver. Skip these by exporting or passing `SKIP_NETWORK_TEST`, e.g.

```
export SKIP_NETWORK_TEST=true
make tests
```

### manual test execution

If you have [bats](https://github.com/sstephenson/bats) installed, you can
manually trigger tests as well.

```
cd /path/to/dex.git
cd tests
bats .
```


## test development

TBD - for now use existing bats/ files as reference. We prefer to numericaly
prefix filenames to maintain execution order.

### fixtures

Use fixtures to mock complicated/larger expected output.

#### updating help fixtures

```
cd /path/to/dex.git
./dex.sh --help > tests/fixtures/help.txt
./dex.sh help vars > tests/fixtures/help-vars.txt
# &c...
```
{'fraction_non_alphanumeric': 0.11530506721820062, 'fraction_numerical': 0.002068252326783868, 'mean_word_length': 3.8987341772151898, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2682078', 'n_tokens_mistral': 652, 'n_tokens_neox': 610, 'n_words': 239}