summaryrefslogtreecommitdiff
path: root/pkg/oniguruma/testing.zig
blob: 234b5e759975cde3e0d842687c06a59f3e5dc5c9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
const init = @import("init.zig");
const Encoding = @import("types.zig").Encoding;

var initialized: bool = false;

/// Call this function before any other tests in this package to ensure that
/// the oni library is initialized. This should only be used for tests
/// and only when you're sure this is the ONLY way that oni is being
/// initialized.
///
/// This always only initializes the encodings the tests use.
pub fn ensureInit() !void {
    if (initialized) return;
    try init.init(&.{Encoding.utf8});
}