v test: add ability to test a folder or a set of _test.v files

* v test: support for running 'v test folder/' .

* Support passing multiple folders and also single _test.v files to 'v test' .

* Update vhelp too, with descriptions of v test folder/ and v -stats .

* Fix running `v test v` from outside the root of the v tree.
This commit is contained in:
Delyan Angelov 2019-10-09 06:01:43 +03:00 committed by Alexander Medvednikov
parent f570cbfca8
commit dbd72ee828
4 changed files with 210 additions and 122 deletions

View file

@ -224,7 +224,26 @@ fn (s mut Scanner) get_scanner_pos_of_token(t &Token) ScannerPos {
// of the token. Continue scanning for some more lines of context too.
s.goto_scanner_position(ScannerPos{})
s.file_lines = []string
mut prevlinepos := 0
// NB: TCC BUG workaround: removing the `mut ate:=0 ate++` line
// below causes a bug in v, when v is compiled with tcc, and v
// wants to report the error: 'the following imports were never used:'
//
// This can be reproduced, if you follow the steps:
// a) ./v -cc tcc -o v compiler ;
// b) ./v vlib/builtin/hashmap_test.v'
//
// In this case, prevlinepos gets a random value on each run.
// Any kind of operation may be used seemingly, as long as
// there is a new stack allocation that will 'protect' prevlinepos.
//////////////////////////////////////////////////////////////////
mut ate:=0 ate++ // This var will be smashed by TCC, instead of
/////////////////// prevlinepos. The cause is the call to
/////////////////// s.get_scanner_pos()
/////////////////// which just returns a struct, and that works
/////////////////// in gcc and clang, but causes the TCC problem.
for {
prevlinepos = s.pos
if s.pos >= s.text.len { break }