docs-v2/content/flux/v0/stdlib/internal/testing/assertmatches.md

1.5 KiB

title description menu weight flux/v0/tags introduced
testing.assertMatches() function `testing.assertMatches()` tests whether a string matches a given regex.
flux_v0_ref
name parent identifier
testing.assertMatches internal/testing internal/testing/assertMatches
201
tests
LATEST

testing.assertMatches() tests whether a string matches a given regex.

Function type signature
(got: string, want: regexp) => stream[{v: string, _diff: string}]

{{% caption %}} For more information, see Function type signatures. {{% /caption %}}

Parameters

got

({{< req >}}) Value to test.

want

({{< req >}}) Regex to test against.

Examples

Test if two values are equal

import "internal/testing"

testing.assertMatches(got: "123", want: /12/)