Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
47 changes: 13 additions & 34 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,45 +21,45 @@ Running just the integration tests (the tests in this directory):
cargo test --workspace --test tests
```

You may want to [make yourself an alias](#making-an-alias) `testit` so that you can
write shorter commands. In the examples below, we will use this alias.
The repository includes the alias `cargo testit` to make this less verbose. In
the examples below, we will use this alias.

Running all tests with the given name pattern. You can use
[regular expression](https://docs.rs/regex/latest/regex/)s.
```bash
testit math # The name has "math" anywhere
testit math page # The name has "math" or "page" anywhere
testit "^math" "^page" # The name begins with "math" or "page"
testit "^(math|page)" # Same as above.
cargo testit math # The name has "math" anywhere
cargo testit math page # The name has "math" or "page" anywhere
cargo testit "^math" "^page" # The name begins with "math" or "page"
cargo testit "^(math|page)" # Same as above.
```

Running all tests discovered under given paths:
```bash
testit -p tests/suite/math/attach.typ
testit -p tests/suite/model -p tests/suite/text
cargo testit -p tests/suite/math/attach.typ
cargo testit -p tests/suite/model -p tests/suite/text
```

Running tests that begin with `issue` under a given path:
```bash
testit "^issue" -p tests/suite/model
cargo testit "^issue" -p tests/suite/model
```

Running a test with the exact test name `math-attach-mixed`.
```bash
testit --exact math-attach-mixed
cargo testit --exact math-attach-mixed
```

You may find more options in the help message:
```bash
testit --help
cargo testit --help
```

To make the integration tests go faster they don't generate PDFs or SVGs by
default. Pass the `--pdf` or `--svg` flag to generate those. Mind that PDFs and
SVGs are **not** tested automatically at the moment, so you should always check
the output manually when making changes.
```bash
testit --pdf
cargo testit --pdf
```

## Writing tests
Expand Down Expand Up @@ -119,32 +119,11 @@ If you created a new test or fixed a bug in an existing test, you may need to
update the reference output used for comparison. For this, you can use the
`--update` flag:
```bash
testit --exact my-test-name --update
cargo testit --exact my-test-name --update
```

For visual tests, this will generally generate compressed reference images (to
remain within the size limit).

If you use the VS Code test helper extension (see the `tools` folder), you can
alternatively use the save button to update the reference output.

## Making an alias
If you want to have a quicker way to run the tests, consider adding a shortcut
to your shell profile so that you can simply write something like:
```bash
testit --exact my-test-name
```

### Bash
Open your Bash configuration by executing `nano ~/.bashrc`.
```bash
alias testit="cargo test --workspace --test tests --"
```

### PowerShell
Open your PowerShell profile by executing `notepad $profile`.
```ps
function testit {
cargo test --workspace --test tests -- $args
}
```
Binary file modified tests/ref/align-center-in-flow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/align-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/align-start-and-end.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/array-basic-syntax.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/array-insert-and-remove.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/array-join-content.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/baseline-box.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/baseline-text.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bibliography-basic.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bibliography-before-content.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bibliography-full.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bibliography-grid-par.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bibliography-indent-par.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bibliography-math.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bibliography-multiple-files.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bibliography-ordering.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bidi-consecutive-embedded-rtl-runs.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bidi-en-he-top-level.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bidi-explicit-dir.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bidi-nesting.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bidi-obj.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bidi-raw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bidi-spacing.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/bidi-whitespace-reset.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/block-box-fill.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/ref/block-clip-svg-glyphs.png
Binary file modified tests/ref/block-clip-text.png
Binary file modified tests/ref/block-clipping-multiple-pages.png
Binary file modified tests/ref/block-consistent-width.png
Binary file modified tests/ref/block-fixed-height.png
Binary file modified tests/ref/block-multiple-pages.png
Binary file modified tests/ref/block-spacing-basic.png
Binary file modified tests/ref/block-spacing-collapse-text-style.png
Binary file modified tests/ref/block-spacing-maximum.png
Binary file modified tests/ref/block-spacing-table.png
Binary file modified tests/ref/box-clip-radius-without-stroke.png
Binary file modified tests/ref/box-clip-radius.png
Binary file modified tests/ref/box-clip-rect.png
Binary file removed tests/ref/box-width-fr.png
Diff not rendered.
Binary file modified tests/ref/box.png
Binary file modified tests/ref/call-basic.png
Binary file modified tests/ref/circle-auto-sizing.png
Binary file modified tests/ref/circle-relative-sizing.png
Binary file modified tests/ref/circle.png
Binary file modified tests/ref/cite-footnote.png
Binary file modified tests/ref/cite-form.png
Binary file modified tests/ref/cite-group.png
Binary file modified tests/ref/cite-grouping-and-ordering.png
Binary file modified tests/ref/closure-path-resolve-in-layout-phase.png
Binary file modified tests/ref/closure-without-params-non-atomic.png
Binary file modified tests/ref/code-block-basic-syntax.png
Binary file modified tests/ref/columns-colbreak-after-place.png
Binary file modified tests/ref/columns-empty-second-column.png
Binary file modified tests/ref/columns-in-auto-sized-rect.png
Binary file modified tests/ref/columns-in-fixed-size-rect.png
Binary file modified tests/ref/columns-one.png
Binary file modified tests/ref/columns-page-height-auto.png
Binary file modified tests/ref/columns-page-width-auto.png
Binary file modified tests/ref/columns-rtl.png
Binary file modified tests/ref/columns-set-page-colbreak-pagebreak.png
Binary file modified tests/ref/columns-set-page.png
Binary file modified tests/ref/coma.png
Binary file modified tests/ref/comment-end-of-line.png
Binary file modified tests/ref/comments.png
Binary file modified tests/ref/content-field-materialized-heading.png
Binary file modified tests/ref/content-field-materialized-query.png
Binary file modified tests/ref/content-field-materialized-table.png
Binary file modified tests/ref/content-fields-complex.png
Binary file modified tests/ref/content-label-field-access.png
Binary file modified tests/ref/content-label-fields-method.png
Binary file modified tests/ref/content-label-has-method.png
Binary file removed tests/ref/context-compatibility-locate.png
Diff not rendered.
Binary file modified tests/ref/counter-basic-1.png
Binary file modified tests/ref/counter-figure.png
Binary file modified tests/ref/counter-heading.png
Binary file modified tests/ref/counter-label.png
Binary file modified tests/ref/counter-page.png
Binary file modified tests/ref/csv.png
Binary file modified tests/ref/curve-stroke-gradient.png
Binary file modified tests/ref/destructuring-during-loop-continue.png
Binary file modified tests/ref/dict-basic-methods.png
Binary file modified tests/ref/dict-basic-syntax.png
Binary file modified tests/ref/dict-remove-order.png
Binary file modified tests/ref/document-set-title.png
Binary file removed tests/ref/double-percent.png
Diff not rendered.
Binary file modified tests/ref/ellipse-auto-sizing.png
Binary file modified tests/ref/emph-and-strong-call-in-word.png
Binary file modified tests/ref/emph-double-underscore-empty-hint.png
Binary file modified tests/ref/emph-syntax.png
Binary file modified tests/ref/enum-built-in-loop.png
Binary file modified tests/ref/enum-function-call.png
Binary file modified tests/ref/enum-number-align-2d.png
Binary file modified tests/ref/enum-number-align-default.png
Binary file modified tests/ref/enum-number-align-specified.png
Binary file modified tests/ref/enum-number-align-unaffected.png
Binary file modified tests/ref/enum-number-align-unfolded.png
Binary file modified tests/ref/enum-number-override-nested.png
Binary file modified tests/ref/enum-number-override.png
Binary file modified tests/ref/enum-numbering-closure-nested-complex.png
Binary file modified tests/ref/enum-numbering-closure-nested.png
Binary file modified tests/ref/enum-numbering-closure.png
Binary file modified tests/ref/enum-numbering-full.png
Binary file modified tests/ref/enum-numbering-pattern.png
Binary file removed tests/ref/enum-numbering-reversed-overriden.png
Diff not rendered.
Binary file modified tests/ref/enum-syntax-at-start.png
Binary file modified tests/ref/enum-syntax-edge-cases.png
Binary file modified tests/ref/escape.png
Binary file modified tests/ref/eval-in-show-rule.png
Binary file modified tests/ref/eval-mode.png
Binary file modified tests/ref/eval-path-resolve-in-show-rule.png
Binary file modified tests/ref/eval-path-resolve.png
Binary file modified tests/ref/figure-and-caption-show.png
Binary file modified tests/ref/figure-basic.png
Binary file modified tests/ref/figure-breakable.png
Binary file modified tests/ref/figure-caption-separator.png
Binary file modified tests/ref/figure-caption-show.png
Binary file modified tests/ref/figure-caption-where-selector.png
Binary file modified tests/ref/figure-localization-el.png
Binary file modified tests/ref/figure-localization-fr.png
Binary file modified tests/ref/figure-localization-ru.png
Binary file modified tests/ref/figure-localization-zh.png
Binary file modified tests/ref/figure-table.png
Binary file modified tests/ref/figure-theorem.png
Binary file modified tests/ref/float-display.png
Binary file removed tests/ref/float-repr.png
Diff not rendered.
Binary file modified tests/ref/flow-first-region-counter-update-and-placed.png
Binary file modified tests/ref/flow-first-region-counter-update.png
Binary file modified tests/ref/flow-first-region-no-item.png
Binary file modified tests/ref/flow-first-region-placed.png
Binary file modified tests/ref/flow-first-region-zero-sized-item.png
Binary file modified tests/ref/flow-fr.png
Binary file modified tests/ref/flow-heading-no-orphan.png
Binary file modified tests/ref/flow-par-no-orphan-and-widow-lines.png
Binary file modified tests/ref/fold-vec-order-meta.png
Binary file modified tests/ref/fold-vec-order-text-decos.png
Binary file modified tests/ref/fold-vec-order-text-features.png
Binary file modified tests/ref/footnote-basic.png
Binary file modified tests/ref/footnote-block-at-end.png
Binary file modified tests/ref/footnote-block-fr.png
Binary file modified tests/ref/footnote-break-across-pages-block.png
Binary file modified tests/ref/footnote-break-across-pages-float.png
Binary file modified tests/ref/footnote-break-across-pages-nested.png
Binary file modified tests/ref/footnote-break-across-pages.png
Binary file modified tests/ref/footnote-duplicate.png
Binary file modified tests/ref/footnote-entry.png
Binary file modified tests/ref/footnote-float-priority.png
Binary file modified tests/ref/footnote-in-caption.png
Binary file modified tests/ref/footnote-in-columns.png
Binary file modified tests/ref/footnote-in-list.png
Binary file modified tests/ref/footnote-in-place.png
Binary file modified tests/ref/footnote-in-table.png
Binary file modified tests/ref/footnote-invariant.png
Binary file modified tests/ref/footnote-multiple-in-one-line.png
Binary file modified tests/ref/footnote-nested-break-across-pages.png
Binary file removed tests/ref/footnote-nested-same-frame.png
Diff not rendered.
Binary file modified tests/ref/footnote-nested.png
Binary file modified tests/ref/footnote-ref-call.png
Binary file modified tests/ref/footnote-ref-forward.png
Binary file modified tests/ref/footnote-ref-in-footnote.png
Binary file modified tests/ref/footnote-ref-multiple.png
Binary file modified tests/ref/footnote-ref.png
Binary file modified tests/ref/footnote-space-collapsing.png
Binary file modified tests/ref/footnote-styling.png
Binary file modified tests/ref/for-loop-basic.png
Binary file modified tests/ref/gradient-conic-text.png
Binary file modified tests/ref/gradient-math-conic.png
Binary file modified tests/ref/gradient-math-dir.png
Binary file modified tests/ref/gradient-math-mat.png
Binary file modified tests/ref/gradient-math-misc.png
Binary file modified tests/ref/gradient-math-radial.png
Binary file modified tests/ref/gradient-presets.png
Binary file modified tests/ref/gradient-radial-text.png
Binary file removed tests/ref/gradient-repr.png
Diff not rendered.
Binary file modified tests/ref/gradient-text-decoration.png
Binary file modified tests/ref/gradient-text-dir.png
Binary file modified tests/ref/gradient-text-global.png
Binary file modified tests/ref/gradient-text-in-container.png
Binary file modified tests/ref/gradient-text-rotate.png
Binary file modified tests/ref/grid-align.png
Binary file modified tests/ref/grid-auto-shrink.png
Binary file modified tests/ref/grid-breaking-expand-vertically.png
Binary file modified tests/ref/grid-calendar.png
Binary file modified tests/ref/grid-cell-align-override.png
Binary file modified tests/ref/grid-cell-breaking.png
Binary file modified tests/ref/grid-cell-folding.png
Binary file modified tests/ref/grid-cell-override-in-header-and-footer.png
Binary file modified tests/ref/grid-cell-override.png
Binary file modified tests/ref/grid-cell-position-automatic-skip-manual.png
Binary file modified tests/ref/grid-cell-position-extra-rows.png
Binary file modified tests/ref/grid-cell-position-out-of-order.png
Binary file modified tests/ref/grid-cell-position-partial.png
Binary file modified tests/ref/grid-cell-set.png
Binary file modified tests/ref/grid-cell-show-and-override.png
Binary file modified tests/ref/grid-cell-show-based-on-position.png
Binary file modified tests/ref/grid-cell-show-emph.png
Binary file modified tests/ref/grid-cell-show.png
Binary file modified tests/ref/grid-cell-various-overrides.png
Binary file modified tests/ref/grid-colspan-gutter.png
Binary file modified tests/ref/grid-colspan-multiple-regions.png
Binary file modified tests/ref/grid-colspan-over-all-fr-columns-page-width-auto.png
Binary file modified tests/ref/grid-colspan-over-all-fr-columns.png
Binary file modified tests/ref/grid-colspan-over-some-fr-columns.png
Binary file modified tests/ref/grid-colspan-thick-stroke.png
Binary file modified tests/ref/grid-colspan.png
Binary file modified tests/ref/grid-complete-rows.png
Binary file modified tests/ref/grid-consecutive-rows-breaking.png
Binary file modified tests/ref/grid-exam.png
Binary file modified tests/ref/grid-fill-func.png
Binary file modified tests/ref/grid-finance.png
Binary file modified tests/ref/grid-footer-bare-1.png
Binary file modified tests/ref/grid-footer-bare-2.png
Binary file modified tests/ref/grid-footer-below-rowspans.png
Binary file modified tests/ref/grid-footer-cell-with-y.png
Binary file removed tests/ref/grid-footer-expand.png
Diff not rendered.
Binary file modified tests/ref/grid-footer-gutter-and-no-repeat.png
Binary file modified tests/ref/grid-footer-hline-and-vline-1.png
Binary file modified tests/ref/grid-footer-hline-and-vline-2.png
Binary file modified tests/ref/grid-footer-relative-row-sizes.png
Binary file modified tests/ref/grid-footer-rowspan.png
Binary file modified tests/ref/grid-footer-stroke-edge-cases.png
Binary file modified tests/ref/grid-footer-top-stroke.png
Binary file modified tests/ref/grid-footer.png
Binary file modified tests/ref/grid-funcs-gutter.png
Binary file modified tests/ref/grid-gutter-fr.png
Binary file modified tests/ref/grid-header-and-footer-containing-rowspan.png
Binary file modified tests/ref/grid-header-and-footer-empty.png
Binary file modified tests/ref/grid-header-and-footer-lack-of-space.png
Binary file modified tests/ref/grid-header-and-footer-orphan-prevention.png
Binary file modified tests/ref/grid-header-and-rowspan-non-contiguous-1.png
Binary file modified tests/ref/grid-header-and-rowspan-non-contiguous-2.png
Binary file modified tests/ref/grid-header-and-rowspan-non-contiguous-3.png
Binary file modified tests/ref/grid-header-block-with-fixed-height.png
Binary file modified tests/ref/grid-header-cell-with-y.png
Binary file modified tests/ref/grid-header-containing-rowspan.png
Binary file modified tests/ref/grid-header-empty.png
Binary file removed tests/ref/grid-header-expand.png
Diff not rendered.
Binary file modified tests/ref/grid-header-footer-and-rowspan-non-contiguous-1.png
Binary file modified tests/ref/grid-header-footer-and-rowspan-non-contiguous-2.png
Binary file modified tests/ref/grid-header-footer-block-with-fixed-height.png
Binary file modified tests/ref/grid-header-hline-and-vline.png
Binary file modified tests/ref/grid-header-hline-bottom-manually.png
Binary file modified tests/ref/grid-header-hline-bottom.png
Binary file modified tests/ref/grid-header-lack-of-space.png
Binary file modified tests/ref/grid-header-last-child.png
Binary file modified tests/ref/grid-header-nested.png
Binary file modified tests/ref/grid-header-orphan-prevention.png
Binary file modified tests/ref/grid-header-relative-row-sizes.png
Binary file modified tests/ref/grid-header-rowspan-base.png
Binary file modified tests/ref/grid-header-stroke-edge-cases.png
Binary file modified tests/ref/grid-headers-gutter.png
Binary file modified tests/ref/grid-headers-no-repeat.png
Binary file modified tests/ref/grid-headers.png
Binary file modified tests/ref/grid-inset-folding.png
Binary file modified tests/ref/grid-inset.png
Binary file modified tests/ref/grid-nested-breaking.png
Binary file modified tests/ref/grid-nested-footers.png
Binary file modified tests/ref/grid-nested-headers.png
Binary file modified tests/ref/grid-nested-with-footers.png
Binary file modified tests/ref/grid-nested-with-headers.png
Binary file modified tests/ref/grid-row-sizing-manual-align.png
Binary file modified tests/ref/grid-rowspan-block-full-height.png
Binary file modified tests/ref/grid-rowspan-cell-coordinates.png
Binary file modified tests/ref/grid-rowspan-cell-order.png
Binary file modified tests/ref/grid-rowspan-excessive-gutter.png
Binary file modified tests/ref/grid-rowspan-excessive.png
Binary file modified tests/ref/grid-rowspan-fixed-size.png
Binary file modified tests/ref/grid-rowspan-gutter.png
Binary file modified tests/ref/grid-rowspan-in-all-columns-stroke-gutter.png
Binary file modified tests/ref/grid-rowspan-in-all-columns-stroke.png
Binary file modified tests/ref/grid-rowspan-over-auto-row.png
Binary file modified tests/ref/grid-rowspan-over-fr-row-at-end.png
Binary file modified tests/ref/grid-rowspan-over-fr-row-at-start.png
Binary file modified tests/ref/grid-rowspan-split-1.png
Binary file modified tests/ref/grid-rowspan-split-11.png
Binary file modified tests/ref/grid-rowspan-split-12.png
Binary file modified tests/ref/grid-rowspan-split-13.png
Binary file modified tests/ref/grid-rowspan-split-14.png
Binary file modified tests/ref/grid-rowspan-split-15.png
Binary file modified tests/ref/grid-rowspan-split-16.png
Binary file modified tests/ref/grid-rowspan-split-17.png
Binary file modified tests/ref/grid-rowspan-split-2.png
Binary file modified tests/ref/grid-rowspan-split-3.png
Binary file modified tests/ref/grid-rowspan-split-4.png
Binary file modified tests/ref/grid-rowspan-split-5.png
Binary file modified tests/ref/grid-rowspan-split-6.png
Binary file modified tests/ref/grid-rowspan-split-7.png
Binary file modified tests/ref/grid-rowspan-split-8.png
Binary file modified tests/ref/grid-rowspan-split-9.png
Binary file modified tests/ref/grid-rowspan-unbreakable-1.png
Binary file modified tests/ref/grid-rowspan-unbreakable-2.png
Binary file modified tests/ref/grid-rowspan.png
Binary file modified tests/ref/grid-rtl-colspan-stroke.png
Binary file modified tests/ref/grid-rtl-colspan.png
Binary file modified tests/ref/grid-rtl-complex.png
Binary file modified tests/ref/grid-rtl-header.png
Binary file modified tests/ref/grid-rtl-multiple-regions.png
Binary file modified tests/ref/grid-rtl-rowspan.png
Loading
Loading