mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
tests: make error handling the same as the main function (#15825)
This commit is contained in:
@@ -63,7 +63,7 @@ fn run(args []string) ?string {
|
||||
}
|
||||
|
||||
// test_alexcrichton_toml_rs run though 'testdata/alexcrichton/toml-test/test-suite/tests/*' if found.
|
||||
fn test_alexcrichton_toml_rs() ? {
|
||||
fn test_alexcrichton_toml_rs() {
|
||||
this_file := @FILE
|
||||
test_root := os.join_path(os.dir(this_file), 'testdata', 'alexcrichton', 'toml-test')
|
||||
if os.is_dir(test_root) {
|
||||
|
@@ -24,7 +24,7 @@ name = "Born in the USA"
|
||||
|
||||
const fprefix = os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))
|
||||
|
||||
fn test_nested_array_of_tables() ? {
|
||||
fn test_nested_array_of_tables() {
|
||||
mut toml_doc := toml.parse_text(toml_text)?
|
||||
|
||||
toml_json := to.json(toml_doc)
|
||||
|
@@ -4,7 +4,7 @@ import toml.to
|
||||
|
||||
const fprefix = os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))
|
||||
|
||||
fn test_array_of_tables_edge_case_file() ? {
|
||||
fn test_array_of_tables_edge_case_file() {
|
||||
toml_doc := toml.parse_file(os.real_path(fprefix + '.toml'))?
|
||||
|
||||
toml_json := to.json(toml_doc)
|
||||
|
@@ -53,7 +53,7 @@ fn run(args []string) ?string {
|
||||
}
|
||||
|
||||
// test_burnt_sushi_tomltest run though 'testdata/burntsushi/toml-test/*' if found.
|
||||
fn test_burnt_sushi_tomltest() ? {
|
||||
fn test_burnt_sushi_tomltest() {
|
||||
this_file := @FILE
|
||||
test_root := os.join_path(os.dir(this_file), 'testdata', 'burntsushi', 'toml-test',
|
||||
'tests')
|
||||
|
@@ -12,7 +12,7 @@ fn test_crlf() {
|
||||
assert value.string() == str_value
|
||||
}
|
||||
|
||||
fn test_crlf_is_parsable_just_like_lf() ? {
|
||||
fn test_crlf_is_parsable_just_like_lf() {
|
||||
crlf_content := '# a comment\r\ntitle = "TOML Example"\r\n[database]\r\nserver = "192.168.1.1"\r\nports = [ 8000, 8001, 8002 ]\r\n'
|
||||
all := [crlf_content, crlf_content.replace('\r\n', '\n')]
|
||||
for content in all {
|
||||
|
@@ -69,7 +69,7 @@ fn run(args []string) ?string {
|
||||
}
|
||||
|
||||
// test_iarna_toml_spec_tests run though 'testdata/iarna/toml-test/*' if found.
|
||||
fn test_iarna_toml_spec_tests() ? {
|
||||
fn test_iarna_toml_spec_tests() {
|
||||
this_file := @FILE
|
||||
test_root := os.join_path(os.dir(this_file), 'testdata', 'iarna', 'toml-test')
|
||||
if os.is_dir(test_root) {
|
||||
|
@@ -4,7 +4,7 @@ import toml.to
|
||||
|
||||
const fprefix = os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))
|
||||
|
||||
fn test_parse() ? {
|
||||
fn test_parse() {
|
||||
toml_doc := toml.parse_file(os.real_path(fprefix + '.toml'))?
|
||||
|
||||
toml_json := to.json(toml_doc)
|
||||
|
@@ -6,7 +6,7 @@ fn path_by_extension(ext string) string {
|
||||
return os.join_path(os.dir(@VEXE), 'vlib/toml/tests/testdata/key_test.$ext')
|
||||
}
|
||||
|
||||
fn test_keys() ? {
|
||||
fn test_keys() {
|
||||
toml_doc := toml.parse_file(path_by_extension('toml'))?
|
||||
|
||||
mut value := toml_doc.value('34-11')
|
||||
@@ -35,7 +35,7 @@ fn test_keys() ? {
|
||||
}
|
||||
}
|
||||
|
||||
fn test_parse_dotted_key() ? {
|
||||
fn test_parse_dotted_key() {
|
||||
assert toml.parse_dotted_key('')? == []
|
||||
assert toml.parse_dotted_key('abc')? == ['abc']
|
||||
assert toml.parse_dotted_key('tube.test."test.test".h."i.j."."k"')? == ['tube', 'test',
|
||||
|
Reference in New Issue
Block a user