<commit_before>" Tests for vesting.

scriptencoding utf-8

" Saving 'cpoptions' {{{
let s:save_cpo = &cpo
set cpo&vim
" }}}

Context Lexer.run()
  It tests escape
    Should vimproc#parser#split_args('echo "\""')
          \ == ['echo', '"']
    Should vimproc#parser#split_args('echo "\`test\`"')
          \ == ['echo', '`test`']
  End

  It tests quote exeption
    let is_catched = 0
    try
      call vimproc#parser#split_args('echo "\"')
    catch /^Exception: Quote/
      let is_catched = 1
    endtry
    Should is_catched
  End

  It tests join to next line exeption
    let is_catched = 0
    try
      call vimproc#parser#split_args('echo \')
    catch /^Exception: Join to next line/
      let is_catched = 1
    endtry
    Should is_catched
  End

  It tests vimproc#shellescape()
    Should vimproc#shellescape('hoge') == "'hoge'"
    Should vimproc#shellescape('ho''ge') == "'ho''ge'"
  End

  It tests vimproc#parser#parse_statements()
    let statements =
          \ vimproc#parser#split_statements(
          \ '"/usr/bin/clang++" --std=c++0x `pkg-config'.
          \ ' --libs opencv` "/home/me/opencv/capture.cpp"'.
          \ ' -o "/home/me/opencv/capture" && "/home/me/opencv/capture"')
    Should statements == ['"/usr/bin/clang++" --std=c++0x `pkg-config'.
          \ ' --libs opencv` "/home/me/opencv/capture.cpp"'.
          \ ' -o "/home/me/opencv/capture" ', ' "/home/me/opencv/capture"'
          \ ]
  End

  It tests backquote
    ShouldEqual vimproc#parser#split_args('echo `echo "hoge" "piyo" "hogera"`'),
          \ [ 'echo', 'hoge', 'piyo', 'hogera' ]
    ShouldEqual vimproc#parser#split_args(
          \ 'echo "`curl -fs https://gist.github.com/raw/4349265/sudden-vim.py`"'),
          \ [ 'echo', system('curl -fs https://gist.github.com/raw/4349265/sudden-vim.py')]

  End
End

Fin

" Restore 'cpoptions' {{{
let &cpo = s:save_cpo
" }}}

" vim:foldmethod=marker:fen:<commit_msg>- Added test for Vital.DateTime.<commit_after>" Tests for vesting.

scriptencoding utf-8

" Saving 'cpoptions' {{{
let s:save_cpo = &cpo
set cpo&vim
" }}}

Context Lexer.run()
  It tests escape
    Should vimproc#parser#split_args('echo "\""')
          \ == ['echo', '"']
    Should vimproc#parser#split_args('echo "\`test\`"')
          \ == ['echo', '`test`']
  End

  It tests quote exeption
    let is_catched = 0
    try
      call vimproc#parser#split_args('echo "\"')
    catch /^Exception: Quote/
      let is_catched = 1
    endtry
    Should is_catched
  End

  It tests join to next line exeption
    let is_catched = 0
    try
      call vimproc#parser#split_args('echo \')
    catch /^Exception: Join to next line/
      let is_catched = 1
    endtry
    Should is_catched
  End

  It tests vimproc#shellescape()
    Should vimproc#shellescape('hoge') == "'hoge'"
    Should vimproc#shellescape('ho''ge') == "'ho''ge'"
  End

  It tests vimproc#parser#parse_statements()
    let statements =
          \ vimproc#parser#split_statements(
          \ '"/usr/bin/clang++" --std=c++0x `pkg-config'.
          \ ' --libs opencv` "/home/me/opencv/capture.cpp"'.
          \ ' -o "/home/me/opencv/capture" && "/home/me/opencv/capture"')
    Should statements == ['"/usr/bin/clang++" --std=c++0x `pkg-config'.
          \ ' --libs opencv` "/home/me/opencv/capture.cpp"'.
          \ ' -o "/home/me/opencv/capture" ', ' "/home/me/opencv/capture"'
          \ ]
  End

  It tests backquote
    ShouldEqual vimproc#parser#split_args('echo `echo "hoge" "piyo" "hogera"`'),
          \ [ 'echo', 'hoge', 'piyo', 'hogera' ]
    ShouldEqual vimproc#parser#split_args(
          \ 'echo "`curl -fs https://gist.github.com/raw/4349265/sudden-vim.py`"'),
          \ [ 'echo', system('curl -fs https://gist.github.com/raw/4349265/sudden-vim.py')]

  End

  It tests slash convertion
    " For Vital.DateTime
    ShouldEqual vimproc#parser#split_args(printf('reg query "%s" /v Bias',
          \ 'HKLM\System\CurrentControlSet\Control\TimeZoneInformation')),
          \ ['reg', 'query',
          \  'HKLM\System\CurrentControlSet\Control\TimeZoneInformation',
          \  '/v', 'Bias']
  End
End

Fin

" Restore 'cpoptions' {{{
let &cpo = s:save_cpo
" }}}

" vim:foldmethod=marker:fen:
{'fraction_non_alphanumeric': 0.16924173995721417, 'fraction_numerical': 0.009983361064891847, 'mean_word_length': 2.6027397260273974, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, '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': '4361861', 'n_tokens_mistral': 1603, 'n_tokens_neox': 1528, 'n_words': 306}