| 1 | pub interface ReaderWriter { |
| 2 | read(mut buf []u8) ?int // from Reader |
| 3 | write(buf []u8) ?int // from Writer |
| 4 | } |
| 5 | |
| 6 | interface Speaker { |
| 7 | // first |
| 8 | speak() string |
| 9 | // between |
| 10 | foo() string |
| 11 | foo2() string |
| 12 | // last |
| 13 | } |
| 14 | |
| 15 | interface Baz { |
| 16 | // first |
| 17 | speak() string |
| 18 | // comment |
| 19 | // more between |
| 20 | foo() string |
| 21 | foo2() string |
| 22 | // last |
| 23 | } |
| 24 | |
| 25 | interface Bar { |
| 26 | speak() string // after |
| 27 | foo() string |
| 28 | speak2() string // also after |
| 29 | // and between |
| 30 | foo2() string |
| 31 | } |
| 32 | |
| 33 | interface TestsRunner { |
| 34 | mut: |
| 35 | fn_passes u64 |
| 36 | fn_fails u64 |
| 37 | assert_passes u64 |
| 38 | assert_fails u64 |
| 39 | test_fn_info &TestFnMetaInfo // filled in by generated code, before .fn_start() is called. |
| 40 | start(ntests int) // called before all tests, you can initialise private data here. ntests is the number of test functions in the _test.v file. |
| 41 | finish() // called after all tests are finished, you should free all the private data here. |
| 42 | // |
| 43 | fn_start() // called at the start of each test_ function |
| 44 | fn_pass() // called at the end of each test_ function, with no failed assertion |
| 45 | fn_error(line_nr int, file string, mod string, fn_name string, errmsg string) // called only for `fn test_xyz() ? { return error('message') }` |
| 46 | fn_fail() // called at the end of each test_ function, with a failed assertion, *or* returning an error |
| 47 | // |
| 48 | assert_pass(i &AssertMetaInfo) // called for each `assert true` |
| 49 | assert_fail(i &AssertMetaInfo) // called for each `assert false` |
| 50 | } |
| 51 | |