#testing
Xu 0.16.0 API
import: #testing
counts: 4 functions, 22 methods, 2 types, 0 constants, 0 method sets
T: error/fatal/skip/run and *f formatters. LIFO cleanup. Cannot import outside test builds.
struct T
pub struct T {
pub failed int
pub skipped int
pub name string
pub cleanups []fn()
}
Purpose
Structure encapsulating failed, skipped, name, cleanups.
Public fields
failed int- field (int)
skipped int- field (int)
name string- name
cleanups []fn()- field ([]fn())
t
Purpose
Execute t.
Parameters
No arguments are required.
Returns
T — a value of this type
t_named
pub fn t_named(name string) T
Purpose
T named.
Parameters
name string- name (string)
Returns
T — a value of this type
(T) name
pub fn (t T) name() string
Purpose
Execute name on T.
Parameters
t T- The
T instance used by this call (value receiver).
Returns
string — result string
(T) helper
Purpose
Execute helper on T.
Parameters
t T- The
T instance used by this call (value receiver).
Returns
This call does not return a value.
(T) failed
pub fn (t T) failed() bool
Purpose
Execute failed on T.
Parameters
t T- The
T instance used by this call (value receiver).
Returns
bool — true or false
(T) skipped
pub fn (t T) skipped() bool
Purpose
Execute skipped on T.
Parameters
t T- The
T instance used by this call (value receiver).
Returns
bool — true or false
($&T) log
pub fn (t $&T) log(msg &string)
Purpose
Operation on $&T: natural logarithm.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
msg &string- message (read-only borrow; caller keeps the original; type &string)
Returns
This call does not return a value.
($&T) logf
pub fn (t $&T) logf(f string, args <-> fmt.Arg)
Purpose
Execute logf on $&T.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
f string- callback or format string (string)
args <-> fmt.Arg- variadic fmt.Arg (seen inside the function as []fmt.Arg)
Returns
This call does not return a value.
($&T) fail
Purpose
Execute fail on $&T.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
Returns
This call does not return a value.
($&T) error
pub fn (t $&T) error(msg &string)
Purpose
Execute error on $&T.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
msg &string- message (read-only borrow; caller keeps the original; type &string)
Returns
This call does not return a value.
($&T) errorf
pub fn (t $&T) errorf(f string, args <-> fmt.Arg)
Purpose
Operation on $&T: build an error from a format string.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
f string- callback or format string (string)
args <-> fmt.Arg- variadic fmt.Arg (seen inside the function as []fmt.Arg)
Returns
This call does not return a value.
($&T) fail_now
pub fn (t $&T) fail_now()
Purpose
Operation on $&T: fail now.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
Returns
This call does not return a value.
($&T) fatal
pub fn (t $&T) fatal(msg &string)
Purpose
Execute fatal on $&T.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
msg &string- message (read-only borrow; caller keeps the original; type &string)
Returns
This call does not return a value.
($&T) fatalf
pub fn (t $&T) fatalf(f string, args <-> fmt.Arg)
Purpose
Execute fatalf on $&T.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
f string- callback or format string (string)
args <-> fmt.Arg- variadic fmt.Arg (seen inside the function as []fmt.Arg)
Returns
This call does not return a value.
($&T) skip_now
pub fn (t $&T) skip_now()
Purpose
Operation on $&T: skip now.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
Returns
This call does not return a value.
($&T) skip
pub fn (t $&T) skip(msg &string)
Purpose
Execute skip on $&T.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
msg &string- message (read-only borrow; caller keeps the original; type &string)
Returns
This call does not return a value.
($&T) skipf
pub fn (t $&T) skipf(f string, args <-> fmt.Arg)
Purpose
Execute skipf on $&T.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
f string- callback or format string (string)
args <-> fmt.Arg- variadic fmt.Arg (seen inside the function as []fmt.Arg)
Returns
This call does not return a value.
($&T) cleanup
pub fn (t $&T) cleanup(f fn())
Purpose
Execute cleanup on $&T.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
f fn()- Callback with signature
fn(); pass the function value for this operation to invoke.
Returns
This call does not return a value.
($&T) run_cleanup
pub fn (t $&T) run_cleanup()
Purpose
LIFO. The language test harness does not call this; tests must invoke it.
Parameters
t $&T- The
T instance used by this call (exclusive borrow).
Returns
This call does not return a value.
(T) run
pub fn (t T) run(name string) T
Purpose
Execute run on T.
Parameters
t T- The
T instance used by this call (value receiver).
name string- name (string)
Returns
T — a value of this type
short
Purpose
Execute short.
Parameters
No arguments are required.
Returns
bool — true or false
struct B
pub struct B {
pub n int
pub failed int
pub name string
}
Purpose
Structure encapsulating n, failed, name.
Public fields
n int- count, length, or limit
failed int- field (int)
name string- name
b
Purpose
Execute b.
Parameters
n int- count, length, or limit (int)
Returns
B — a value of this type
($&B) fail
Purpose
Execute fail on $&B.
Parameters
b $&B- The
B instance used by this call (exclusive borrow).
Returns
This call does not return a value.
($&B) errorf
pub fn (b $&B) errorf(f string, args <-> fmt.Arg)
Purpose
Operation on $&B: build an error from a format string.
Parameters
b $&B- The
B instance used by this call (exclusive borrow).
f string- callback or format string (string)
args <-> fmt.Arg- variadic fmt.Arg (seen inside the function as []fmt.Arg)
Returns
This call does not return a value.
($&B) fatalf
pub fn (b $&B) fatalf(f string, args <-> fmt.Arg)
Purpose
Execute fatalf on $&B.
Parameters
b $&B- The
B instance used by this call (exclusive borrow).
f string- callback or format string (string)
args <-> fmt.Arg- variadic fmt.Arg (seen inside the function as []fmt.Arg)
Returns
This call does not return a value.
(B) failed
pub fn (b B) failed() bool
Purpose
Execute failed on B.
Parameters
b B- The
B instance used by this call (value receiver).
Returns
bool — true or false