/
githubmirror
/
julia
Обзор
Документация
Войти
/
githubmirror
/
julia
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
stdlib/TOML/test/error_printing.jl
38 строк
959 B
KristofferC
add license to top of new files
16 окт 2020, 22:41
16 окт 2020, 22:41
a37e0ae
Код
Авторство
О чём код?
# This file is a part of Julia. License is MIT: https://julialang.org/license using Test import TOML: tryparsefile # These tests need to be updated if the error strings change tmp = tempname() @testset "error printing" begin # Special printing for invalid bare key character write(tmp, "fooα = 3") p = tryparsefile(tmp) err = sprint(Base.showerror, p) @test contains(err, """ $tmp:1:4 error: invalid bare key character: 'α' fooα = 3 ^""") # Error is at EOF write(tmp, "foo = [1, 2,") p = tryparsefile(tmp) err = sprint(Base.showerror, p) @test contains(err, """ $tmp:1:12 error: unexpected end of file, expected a value foo = [1, 2, ^""") # A bit of unicode write(tmp, "\"fαβ\" = [1.2, 1.2.3]") p = tryparsefile(tmp) err = sprint(Base.showerror, p) @test contains(err, """ $tmp:1:18 error: failed to parse value "fαβ" = [1.2, 1.2.3] ^""") end # testset