Merge pull request #2446 from vim-airline/fix-assertion-roulette

[fix] assertion roulette in test
This commit is contained in:
IK 2021-11-03 16:14:50 +09:00 committed by GitHub
commit ddaf69804a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 3 deletions

View File

@ -9,21 +9,34 @@ describe 'commands'
Expect exists('#airline') to_be_true Expect exists('#airline') to_be_true
end end
it 'should toggle whitespace off and on' it 'should toggle whitespace off'
call airline#extensions#load() call airline#extensions#load()
execute 'AirlineToggleWhitespace' execute 'AirlineToggleWhitespace'
Expect exists('#airline_whitespace') to_be_false Expect exists('#airline_whitespace') to_be_false
end
it 'should toggle whitespace on'
call airline#extensions#load()
execute 'AirlineToggleWhitespace' execute 'AirlineToggleWhitespace'
Expect exists('#airline_whitespace') to_be_true Expect exists('#airline_whitespace') to_be_true
end end
it 'should display theme name with no args' it 'should display theme name "simple"'
execute 'AirlineTheme simple' execute 'AirlineTheme simple'
Expect g:airline_theme == 'simple' Expect g:airline_theme == 'simple'
end
it 'should display theme name "dark"'
execute 'AirlineTheme dark' execute 'AirlineTheme dark'
Expect g:airline_theme == 'dark' Expect g:airline_theme == 'dark'
end
it 'should display theme name "dark" because specifying a name that does not exist'
execute 'AirlineTheme doesnotexist' execute 'AirlineTheme doesnotexist'
Expect g:airline_theme == 'dark' Expect g:airline_theme == 'dark'
end
it 'should display theme name molokai'
colors molokai colors molokai
Expect g:airline_theme == 'molokai' Expect g:airline_theme == 'molokai'
end end

View File

@ -11,13 +11,33 @@ describe 'default'
let s:builder = airline#builder#new({'active': 1}) let s:builder = airline#builder#new({'active': 1})
end end
it 'should use the layout' it 'should use the layout "airline_a_to_airline_b"'
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 }) call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 })
let stl = s:builder.build() let stl = s:builder.build()
Expect stl =~ 'airline_c_to_airline_a' Expect stl =~ 'airline_c_to_airline_a'
end
it 'should use the layout "airline_a_to_airline_b"'
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 })
let stl = s:builder.build()
Expect stl =~ 'airline_a_to_airline_b' Expect stl =~ 'airline_a_to_airline_b'
end
it 'should use the layout "airline_b_to_airline_warning"'
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 })
let stl = s:builder.build()
Expect stl =~ 'airline_b_to_airline_warning' Expect stl =~ 'airline_b_to_airline_warning'
end
it 'should use the layout "airline_x_to_airline_z"'
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 })
let stl = s:builder.build()
Expect stl =~ 'airline_x_to_airline_z' Expect stl =~ 'airline_x_to_airline_z'
end
it 'should use the layout "airline_z_to_airline_y"'
call airline#extensions#default#apply(s:builder, { 'winnr': 1, 'active': 1 })
let stl = s:builder.build()
Expect stl =~ 'airline_z_to_airline_y' Expect stl =~ 'airline_z_to_airline_y'
end end