mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
toml: add 1MB file parsing test to CI (#12582)
This commit is contained in:
parent
253e38d9d7
commit
04b030b7ab
6
.github/workflows/toml_ci.yml
vendored
6
.github/workflows/toml_ci.yml
vendored
@ -36,3 +36,9 @@ jobs:
|
||||
|
||||
- name: Run BurntSushi TOML tests
|
||||
run: ./v vlib/toml/tests/burntsushi.toml-test_test.v
|
||||
|
||||
- name: Get large_toml_file_test.toml
|
||||
run: wget https://gist.githubusercontent.com/Larpon/89b0e3d94c6903851ff15559e5df7a05/raw/62a1f87a4e37bf157f2e0bfb32d85d840c98e422/large_toml_file_test.toml -O vlib/toml/tests/testdata/large_toml_file_test.toml
|
||||
|
||||
- name: Run large TOML file tests
|
||||
run: ./v vlib/toml/tests/large_toml_file_test.v
|
||||
|
21
vlib/toml/tests/large_toml_file_test.v
Normal file
21
vlib/toml/tests/large_toml_file_test.v
Normal file
@ -0,0 +1,21 @@
|
||||
import os
|
||||
import toml
|
||||
|
||||
// Instructions for developers:
|
||||
// The large (1MB) TOML file can be obtained by doing:
|
||||
// `cd vlib/toml/tests/testdata`
|
||||
// `wget https://gist.githubusercontent.com/Larpon/89b0e3d94c6903851ff15559e5df7a05/raw/62a1f87a4e37bf157f2e0bfb32d85d840c98e422/large_toml_file_test.toml`
|
||||
|
||||
// See also the CI toml tests
|
||||
|
||||
// test_large_file parser 'testdata/large_toml_file_test.toml' if found.
|
||||
fn test_large_file() {
|
||||
toml_file :=
|
||||
os.real_path(os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))) +
|
||||
'.toml'
|
||||
if os.exists(toml_file) {
|
||||
println('Testing parsing of large (${os.file_size(toml_file)} bytes) "$toml_file"...')
|
||||
toml_doc := toml.parse(toml_file) or { panic(err) }
|
||||
println('OK [1/1] "$toml_file"...') // So it can be checked with `v -stats test ...`
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user