v2 / vlib / v / tests / options / option_print_errors_test.v
20 lines · 17 sloc · 403 bytes · 6488041a749df9762348d019c4223908c476f2e2
Raw
1fn test_error_can_be_converted_to_string() {
2 assert 'an error' == error('an error').str()
3}
4
5fn test_error_can_be_assigned_to_a_variable() {
6 f := error('an error')
7 assert 'an error' == f.msg()
8}
9
10fn test_error_can_be_printed() {
11 f := error('an error')
12 println(f)
13 assert true
14}
15
16fn test_error_can_be_interpolated_in_a_string() {
17 f := error('an error')
18 s := 'hi ${f}'
19 assert s == 'hi an error'
20}
21