V version: V 0.1.19 a555b1f
OS: Linux Mint 19.1
What did you do?
test.v with content:
import net.urllib
import http
pub fn main() {
urls := [
'http://bugurl'
]
for url in urls {
println('Getting Bugs: $url ')
}
}
then:
./v compile test.v
and run
./test
with output:
Getting Bugs: http://bugurl
Then renamed the source file test.v into test_test.v
and then a compiler run
./v compile test_test.v
and a execute
./test_test
and no println output nothing at all.
Is there a special meaning with test in the source file name ?
What did you expect to see?
The same output
What did you see instead?
Yes, @schoko123, file names ending in _test.v are ment for testing and are treated differently. Please see here: https://vlang.io/docs#testing
For the files ending in _test.v, the compiler compiles and runs every function with the test_ in the begining of the function name.
Ok it seems to be a feature... Close this now..
I'd keep it open until V handles this case.
It should show an error message if there's fn main in a test file.
It should also then show an error message if there are no test_* functions in a file.
@schoko123 btw, there is no need to specify v compile file.v . v file.v is enough.
Fixed.
It should also then show an error message if there are no test_* functions in a file.
@avitkauskas This has been implemented as well.