1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-01-24 05:30:07 +08:00
SpaceVim/bundle/dein.vim/test/toml.vim
2020-06-13 14:06:35 +08:00

40 lines
1.1 KiB
VimL

let s:suite = themis#suite('toml')
let s:assert = themis#helper('assert')
function! s:suite.before_each() abort
let g:temp = tempname()
endfunction
function! s:suite.after_each() abort
call delete(g:temp)
endfunction
function! s:suite.normal() abort
call writefile([
\ '# This is a TOML document.',
\ '',
\ 'title = "TOML Example"',
\ 'foo = {i = ''Plug''}',
\ 'map = {i = "Plug", c = "Plug"}',
\ '',
\ '[owner]',
\ 'name = "Tom Preston-Werner"',
\ 'dob = 1979 # First class dates',
\ ], g:temp)
call s:assert.equals(dein#toml#parse_file(g:temp), {
\ 'title': 'TOML Example',
\ 'foo': {'i': 'Plug'},
\ 'map': {'i': 'Plug', 'c': 'Plug'},
\ 'owner': {'name': 'Tom Preston-Werner', 'dob': 1979}
\ })
call writefile([
\ '[[foo]]',
\ '[[foo]]',
\ '[foo.ftplugin]',
\ 'c = "let g:bar = 0"',
\ ], g:temp)
call s:assert.equals(dein#toml#parse_file(g:temp), {
\ 'foo': [{}, {'ftplugin': {'c': 'let g:bar = 0'}}]
\ })
endfunction