Skip to content

Commit 04b030b

Browse files
authored
toml: add 1MB file parsing test to CI (#12582)
1 parent 253e38d commit 04b030b

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

.github/workflows/toml_ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,9 @@ jobs:
3636
3737
- name: Run BurntSushi TOML tests
3838
run: ./v vlib/toml/tests/burntsushi.toml-test_test.v
39+
40+
- name: Get large_toml_file_test.toml
41+
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
42+
43+
- name: Run large TOML file tests
44+
run: ./v vlib/toml/tests/large_toml_file_test.v
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import os
2+
import toml
3+
4+
// Instructions for developers:
5+
// The large (1MB) TOML file can be obtained by doing:
6+
// `cd vlib/toml/tests/testdata`
7+
// `wget https://gist.githubusercontent.com/Larpon/89b0e3d94c6903851ff15559e5df7a05/raw/62a1f87a4e37bf157f2e0bfb32d85d840c98e422/large_toml_file_test.toml`
8+
9+
// See also the CI toml tests
10+
11+
// test_large_file parser 'testdata/large_toml_file_test.toml' if found.
12+
fn test_large_file() {
13+
toml_file :=
14+
os.real_path(os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))) +
15+
'.toml'
16+
if os.exists(toml_file) {
17+
println('Testing parsing of large (${os.file_size(toml_file)} bytes) "$toml_file"...')
18+
toml_doc := toml.parse(toml_file) or { panic(err) }
19+
println('OK [1/1] "$toml_file"...') // So it can be checked with `v -stats test ...`
20+
}
21+
}

0 commit comments

Comments
 (0)