<commit_before>call airline#init#bootstrap()
call airline#init#sections()

function! MyFuncref(...)
  call a:1.add_raw('hello world')
  return 1
endfunction

function! MyIgnoreFuncref(...)
  return -1
endfunction

function! MyAppend1(...)
  call a:1.add_raw('hello')
endfunction

function! MyAppend2(...)
  call a:1.add_raw('world')
endfunction

describe 'airline'
  before
    let g:airline_statusline_funcrefs = []
  end

  it 'should run user funcrefs first'
    call airline#add_statusline_func('MyFuncref')
    let &statusline = ''
    call airline#update_statusline()
    Expect &statusline =~ 'hello world'
  end

  it 'should not change the statusline with -1'
    call airline#add_statusline_funcref(function('MyIgnoreFuncref'))
    let &statusline = 'foo'
    call airline#update_statusline()
    Expect &statusline == 'foo'
  end

  it 'should support multiple chained funcrefs'
    call airline#add_statusline_func('MyAppend1')
    call airline#add_statusline_func('MyAppend2')
    call airline#update_statusline()
    Expect &statusline =~ 'helloworld'
  end

  it 'should allow users to redefine sections'
    let g:airline_section_a = airline#section#create(['mode', 'mode'])
    call airline#update_statusline()
    Expect &statusline =~ '%{airline#util#wrap(airline#parts#mode(),0)}%{airline#util#wrap(airline#parts#mode(),0)}'
  end

  it 'should remove funcrefs properly'
    let c = len(g:airline_statusline_funcrefs)
    call airline#add_statusline_func('MyIgnoreFuncref')
    call airline#remove_statusline_func('MyIgnoreFuncref')
    Expect len(g:airline_statusline_funcrefs) == c
  end
end

<commit_msg>test for window switching and active/inactive splits.<commit_after>call airline#init#bootstrap()
call airline#init#sections()
source plugin/airline.vim

function! MyFuncref(...)
  call a:1.add_raw('hello world')
  return 1
endfunction

function! MyIgnoreFuncref(...)
  return -1
endfunction

function! MyAppend1(...)
  call a:1.add_raw('hello')
endfunction

function! MyAppend2(...)
  call a:1.add_raw('world')
endfunction

describe 'airline'
  before
    let g:airline_statusline_funcrefs = []
  end

  it 'should run user funcrefs first'
    call airline#add_statusline_func('MyFuncref')
    let &statusline = ''
    call airline#update_statusline()
    Expect &statusline =~ 'hello world'
  end

  it 'should not change the statusline with -1'
    call airline#add_statusline_funcref(function('MyIgnoreFuncref'))
    let &statusline = 'foo'
    call airline#update_statusline()
    Expect &statusline == 'foo'
  end

  it 'should support multiple chained funcrefs'
    call airline#add_statusline_func('MyAppend1')
    call airline#add_statusline_func('MyAppend2')
    call airline#update_statusline()
    Expect &statusline =~ 'helloworld'
  end

  it 'should allow users to redefine sections'
    let g:airline_section_a = airline#section#create(['mode', 'mode'])
    call airline#update_statusline()
    Expect &statusline =~ '%{airline#util#wrap(airline#parts#mode(),0)}%{airline#util#wrap(airline#parts#mode(),0)}'
  end

  it 'should remove funcrefs properly'
    let c = len(g:airline_statusline_funcrefs)
    call airline#add_statusline_func('MyIgnoreFuncref')
    call airline#remove_statusline_func('MyIgnoreFuncref')
    Expect len(g:airline_statusline_funcrefs) == c
  end

  it 'should overwrite the statusline with active and inactive splits'
    wincmd s
    Expect getwinvar(1, '&statusline') !~ 'inactive'
    Expect getwinvar(2, '&statusline') =~ 'inactive'
    wincmd c
  end

  it 'should collapse the inactive split if the variable is set true'
    let g:airline_inactive_collapse = 1
    wincmd s
    Expect getwinvar(2, '&statusline') !~ 'airline#parts#mode'
    wincmd c
  end

  it 'should not collapse the inactive split if the variable is set false'
    let g:airline_inactive_collapse = 0
    wincmd s
    Expect getwinvar(2, '&statusline') != 'airline#parts#mode'
    wincmd c
  end
end


{'fraction_non_alphanumeric': 0.11046364327337219, 'fraction_numerical': 0.007600709399543958, 'mean_word_length': 4.64, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6666638', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1276, 'n_words': 318}