<commit_before>let s:suite = themis#suite('parser')
let s:assert = themis#helper('assert')

let g:neobundle#types#git#default_protocol = 'https'
let g:neobundle#types#hg#default_protocol = 'https'
let g:neobundle#enable_name_conversion = 0

function! s:suite.github_git_repos()
  call s:assert.equals(neobundle#parser#path(
        \ 'Shougo/neocomplcache-clang.git'),
        \ {'type' : 'git', 'uri' :
        \   g:neobundle#types#git#default_protocol .
        \  '://github.com/Shougo/neocomplcache-clang.git',
        \  'name' : 'neocomplcache-clang'})
  call s:assert.equals(neobundle#parser#path('Shougo/vimshell'),
        \ {'type' : 'git', 'uri' :
        \   g:neobundle#types#git#default_protocol .
        \  '://github.com/Shougo/vimshell.git',
        \  'name' : 'vimshell'})
  call s:assert.equals(neobundle#parser#path('rails.vim'),
        \ {'type' : 'git', 'uri' :
        \ g:neobundle#types#git#default_protocol .
        \ '://github.com/vim-scripts/rails.vim.git',
        \  'name' : 'rails.vim'})
  call s:assert.equals(neobundle#parser#path('vim-scripts/ragtag.vim'),
        \ {'type' : 'git', 'uri' :
        \ g:neobundle#types#git#default_protocol .
        \ '://github.com/vim-scripts/ragtag.vim.git',
        \  'name' : 'ragtag.vim'})
  call s:assert.equals(neobundle#parser#path(
        \ 'https://github.com/vim-scripts/vim-game-of-life'),
        \ {'type' : 'git', 'uri' :
        \ 'https://github.com/vim-scripts/vim-game-of-life.git',
        \  'name' : 'vim-game-of-life'})
  call s:assert.equals(neobundle#parser#path(
        \ 'git@github.com:gmarik/ingretu.git'),
        \ {'type' : 'git', 'uri' :
        \ 'git@github.com:gmarik/ingretu.git',
        \  'name' : 'ingretu'})
  call s:assert.equals(neobundle#parser#path(
        \ 'gh:gmarik/snipmate.vim.git'),
        \ {'type' : 'git', 'uri' :
        \ g:neobundle#types#git#default_protocol .
        \ '://github.com/gmarik/snipmate.vim.git',
        \  'name' : 'snipmate.vim'})
  call s:assert.equals(neobundle#parser#path(
        \ 'github:mattn/gist-vim.git'),
        \ {'type' : 'git', 'uri' :
        \ g:neobundle#types#git#default_protocol .
        \ '://github.com/mattn/gist-vim.git',
        \  'name' : 'gist-vim'})
  call s:assert.equals(neobundle#parser#path(
        \ 'git@github.com:Shougo/neocomplcache.git'),
        \ {'type' : 'git', 'uri' :
        \ 'git@github.com:Shougo/neocomplcache.git',
        \  'name' : 'neocomplcache'})
  call s:assert.equals(neobundle#parser#path(
        \ 'https://github.com/Shougo/neocomplcache/'),
        \ {'type' : 'git', 'uri' :
        \ 'https://github.com/Shougo/neocomplcache.git',
        \  'name' : 'neocomplcache'})
  call s:assert.equals(neobundle#parser#path(
        \ 'git://git.wincent.com/command-t.git'),
        \ {})
  call s:assert.equals(neobundle#parser#path(
        \ 'http://github.com/Shougo/neocomplcache/'),
        \ {})
endfunction

function! s:suite.svn_repos()
  call s:assert.equals(neobundle#parser#path(
        \ 'http://svn.macports.org/repository/macports/contrib/mpvim/'),
        \ {})
  call s:assert.equals(neobundle#parser#path(
        \ 'https://svn.macports.org/repository/macports/contrib/mpvim/'),
        \ {'type' : 'svn', 'uri' :
        \  'https://svn.macports.org/repository/macports/contrib/mpvim',
        \  'name' : 'mpvim'})
  call s:assert.equals(neobundle#parser#path(
        \ 'thinca/vim-localrc', {'type' : 'svn'}),
        \ {'type' : 'svn', 'uri' :
        \  'https://github.com/thinca/vim-localrc/trunk',
        \  'name' : 'vim-localrc'})
endfunction

function! s:suite.hg_repos()
  call s:assert.equals(neobundle#parser#path(
        \ 'https://bitbucket.org/ns9tks/vim-fuzzyfinder'),
        \ {'type' : 'hg', 'uri' :
        \  'https://bitbucket.org/ns9tks/vim-fuzzyfinder',
        \  'name' : 'vim-fuzzyfinder'})
  call s:assert.equals(neobundle#parser#path(
        \ 'bitbucket://bitbucket.org/ns9tks/vim-fuzzyfinder'),
        \ {'type' : 'hg', 'uri' :
        \  g:neobundle#types#hg#default_protocol.
        \  '://bitbucket.org/ns9tks/vim-fuzzyfinder',
        \  'name' : 'vim-fuzzyfinder'})
  call s:assert.equals(neobundle#parser#path(
        \ 'bitbucket:ns9tks/vim-fuzzyfinder'),
        \ {'type' : 'hg', 'uri' :
        \  g:neobundle#types#hg#default_protocol.
        \  '://bitbucket.org/ns9tks/vim-fuzzyfinder',
        \  'name' : 'vim-fuzzyfinder'})
  call s:assert.equals(neobundle#parser#path(
        \ 'ns9tks/vim-fuzzyfinder', {'site': 'bitbucket'}),
        \ {'type' : 'hg', 'uri' :
        \  g:neobundle#types#hg#default_protocol.
        \  '://bitbucket.org/ns9tks/vim-fuzzyfinder',
        \  'name' : 'vim-fuzzyfinder'})

  let bundle = neobundle#parser#_init_bundle(
        \ 'https://github.com/Shougo/neobundle.vim.git',
        \ [{ 'type' : 'hg'}])
  call s:assert.equals(bundle.name, 'neobundle.vim')
  call s:assert.equals(bundle.type, 'hg')
  call s:assert.equals(bundle.uri,
        \ 'https://github.com/Shougo/neobundle.vim.git')
endfunction

function! s:suite.gitbucket_git_repos()
  call s:assert.equals(neobundle#parser#path(
        \ 'https://bitbucket.org/kh3phr3n/vim-qt-syntax.git'),
        \ {'type' : 'git', 'uri' :
        \  'https://bitbucket.org/kh3phr3n/vim-qt-syntax.git',
        \  'name' : 'vim-qt-syntax'})
  call s:assert.equals(neobundle#parser#path(
        \ 'bitbucket:kh3phr3n/vim-qt-syntax.git'),
        \ {'type' : 'git', 'uri' :
        \  g:neobundle#types#git#default_protocol.
        \  '://bitbucket.org/kh3phr3n/vim-qt-syntax.git',
        \  'name' : 'vim-qt-syntax'})
endfunction

function! s:suite.raw_repos()
  let bundle = neobundle#parser#_init_bundle(
        \ 'https://raw.github.com/m2ym/rsense/master/etc/rsense.vim',
        \ [{ 'script_type' : 'plugin'}])
  call s:assert.equals(bundle.name, 'rsense.vim')
  call s:assert.equals(bundle.type, 'raw')
  call s:assert.equals(bundle.uri,
        \ 'https://raw.github.com/m2ym/rsense/master/etc/rsense.vim')
endfunction

function! s:suite.default_options()
  let g:default_options_save = g:neobundle#default_options
  let g:neobundle#default_options =
        \ { 'rev' : {'type__update_style' : 'current'},
        \   '_' : {'type' : 'hg'} }

  let bundle = neobundle#parser#_init_bundle(
        \ 'Shougo/neocomplcache', ['', 'rev', {}])
  call s:assert.equals(bundle.type__update_style, 'current')

  let bundle2 = neobundle#parser#_init_bundle(
        \ 'Shougo/neocomplcache', [])
  call s:assert.equals(bundle2.type, 'hg')

  let g:neobundle#default_options = g:default_options_save
endfunction

function! s:suite.ssh_protocol()
  let bundle = neobundle#parser#_init_bundle(
        \ 'accountname/reponame', [{
        \ 'site' : 'github', 'type' : 'git', 'type__protocol' : 'ssh' }])
  call s:assert.equals(bundle.uri,
        \ 'git@github.com:accountname/reponame.git')

  let bundle = neobundle#parser#_init_bundle(
        \ 'accountname/reponame', [{
        \ 'site' : 'bitbucket', 'type' : 'hg', 'type__protocol' : 'ssh' }])
  call s:assert.equals(bundle.uri,
        \ 'ssh://hg@bitbucket.org/accountname/reponame')<commit_msg>Add tests<commit_after>let s:suite = themis#suite('parser')
let s:assert = themis#helper('assert')

let g:neobundle#types#git#default_protocol = 'https'
let g:neobundle#types#hg#default_protocol = 'https'
let g:neobundle#enable_name_conversion = 0

function! s:suite.github_git_repos()
  call s:assert.equals(neobundle#parser#path(
        \ 'Shougo/neocomplcache-clang.git'),
        \ {'type' : 'git', 'uri' :
        \   g:neobundle#types#git#default_protocol .
        \  '://github.com/Shougo/neocomplcache-clang.git',
        \  'name' : 'neocomplcache-clang'})
  call s:assert.equals(neobundle#parser#path('Shougo/vimshell'),
        \ {'type' : 'git', 'uri' :
        \   g:neobundle#types#git#default_protocol .
        \  '://github.com/Shougo/vimshell.git',
        \  'name' : 'vimshell'})
  call s:assert.equals(neobundle#parser#path('rails.vim'),
        \ {'type' : 'git', 'uri' :
        \ g:neobundle#types#git#default_protocol .
        \ '://github.com/vim-scripts/rails.vim.git',
        \  'name' : 'rails.vim'})
  call s:assert.equals(neobundle#parser#path('vim-scripts/ragtag.vim'),
        \ {'type' : 'git', 'uri' :
        \ g:neobundle#types#git#default_protocol .
        \ '://github.com/vim-scripts/ragtag.vim.git',
        \  'name' : 'ragtag.vim'})
  call s:assert.equals(neobundle#parser#path(
        \ 'https://github.com/vim-scripts/vim-game-of-life'),
        \ {'type' : 'git', 'uri' :
        \ 'https://github.com/vim-scripts/vim-game-of-life.git',
        \  'name' : 'vim-game-of-life'})
  call s:assert.equals(neobundle#parser#path(
        \ '<EMAIL>:gmarik/ingretu.git'),
        \ {'type' : 'git', 'uri' :
        \ '<EMAIL>:gmarik/ingretu.git',
        \  'name' : 'ingretu'})
  call s:assert.equals(neobundle#parser#path(
        \ 'gh:gmarik/snipmate.vim.git'),
        \ {'type' : 'git', 'uri' :
        \ g:neobundle#types#git#default_protocol .
        \ '://github.com/gmarik/snipmate.vim.git',
        \  'name' : 'snipmate.vim'})
  call s:assert.equals(neobundle#parser#path(
        \ 'github:mattn/gist-vim.git'),
        \ {'type' : 'git', 'uri' :
        \ g:neobundle#types#git#default_protocol .
        \ '://github.com/mattn/gist-vim.git',
        \  'name' : 'gist-vim'})
  call s:assert.equals(neobundle#parser#path(
        \ '<EMAIL>:Shougo/neocomplcache.git'),
        \ {'type' : 'git', 'uri' :
        \ '<EMAIL>:Shougo/neocomplcache.git',
        \  'name' : 'neocomplcache'})
  call s:assert.equals(neobundle#parser#path(
        \ 'https://github.com/Shougo/neocomplcache/'),
        \ {'type' : 'git', 'uri' :
        \ 'https://github.com/Shougo/neocomplcache.git',
        \  'name' : 'neocomplcache'})
  call s:assert.equals(neobundle#parser#path(
        \ 'git://git.wincent.com/command-t.git'),
        \ {})
  call s:assert.equals(neobundle#parser#path(
        \ 'http://github.com/Shougo/neocomplcache/'),
        \ {})
endfunction

function! s:suite.svn_repos()
  call s:assert.equals(neobundle#parser#path(
        \ 'http://svn.macports.org/repository/macports/contrib/mpvim/'),
        \ {})
  call s:assert.equals(neobundle#parser#path(
        \ 'https://svn.macports.org/repository/macports/contrib/mpvim/'),
        \ {'type' : 'svn', 'uri' :
        \  'https://svn.macports.org/repository/macports/contrib/mpvim',
        \  'name' : 'mpvim'})
  call s:assert.equals(neobundle#parser#path(
        \ 'thinca/vim-localrc', {'type' : 'svn'}),
        \ {'type' : 'svn', 'uri' :
        \  'https://github.com/thinca/vim-localrc/trunk',
        \  'name' : 'vim-localrc'})
endfunction

function! s:suite.hg_repos()
  call s:assert.equals(neobundle#parser#path(
        \ 'https://bitbucket.org/ns9tks/vim-fuzzyfinder'),
        \ {'type' : 'hg', 'uri' :
        \  'https://bitbucket.org/ns9tks/vim-fuzzyfinder',
        \  'name' : 'vim-fuzzyfinder'})
  call s:assert.equals(neobundle#parser#path(
        \ 'bitbucket://bitbucket.org/ns9tks/vim-fuzzyfinder'),
        \ {'type' : 'hg', 'uri' :
        \  g:neobundle#types#hg#default_protocol.
        \  '://bitbucket.org/ns9tks/vim-fuzzyfinder',
        \  'name' : 'vim-fuzzyfinder'})
  call s:assert.equals(neobundle#parser#path(
        \ 'bitbucket:ns9tks/vim-fuzzyfinder'),
        \ {'type' : 'hg', 'uri' :
        \  g:neobundle#types#hg#default_protocol.
        \  '://bitbucket.org/ns9tks/vim-fuzzyfinder',
        \  'name' : 'vim-fuzzyfinder'})
  call s:assert.equals(neobundle#parser#path(
        \ 'ns9tks/vim-fuzzyfinder', {'site': 'bitbucket'}),
        \ {'type' : 'hg', 'uri' :
        \  g:neobundle#types#hg#default_protocol.
        \  '://bitbucket.org/ns9tks/vim-fuzzyfinder',
        \  'name' : 'vim-fuzzyfinder'})

  let bundle = neobundle#parser#_init_bundle(
        \ 'https://github.com/Shougo/neobundle.vim.git',
        \ [{ 'type' : 'hg'}])
  call s:assert.equals(bundle.name, 'neobundle.vim')
  call s:assert.equals(bundle.type, 'hg')
  call s:assert.equals(bundle.uri,
        \ 'https://github.com/Shougo/neobundle.vim.git')
endfunction

function! s:suite.gitbucket_git_repos()
  call s:assert.equals(neobundle#parser#path(
        \ 'https://bitbucket.org/kh3phr3n/vim-qt-syntax.git'),
        \ {'type' : 'git', 'uri' :
        \  'https://bitbucket.org/kh3phr3n/vim-qt-syntax.git',
        \  'name' : 'vim-qt-syntax'})
  call s:assert.equals(neobundle#parser#path(
        \ 'bitbucket:kh3phr3n/vim-qt-syntax.git'),
        \ {'type' : 'git', 'uri' :
        \  g:neobundle#types#git#default_protocol.
        \  '://bitbucket.org/kh3phr3n/vim-qt-syntax.git',
        \  'name' : 'vim-qt-syntax'})
endfunction

function! s:suite.raw_repos()
  call s:assert.equals(neobundle#parser#path(
        \ 'http://raw.github.com/m2ym/rsense/master/etc/rsense.vim'),
        \ {})
  call s:assert.equals(neobundle#parser#path(
        \ 'http://www.vim.org/scripts/download_script.php?src_id=19237'),
        \ {})
  let bundle = neobundle#parser#_init_bundle(
        \ 'https://raw.github.com/m2ym/rsense/master/etc/rsense.vim',
        \ [{ 'script_type' : 'plugin'}])
  call s:assert.equals(bundle.name, 'rsense.vim')
  call s:assert.equals(bundle.type, 'raw')
  call s:assert.equals(bundle.uri,
        \ 'https://raw.github.com/m2ym/rsense/master/etc/rsense.vim')
endfunction

function! s:suite.vba_repos()
  call s:assert.equals(neobundle#parser#path(
        \ 'https://foo/bar.vba'),
        \ { 'name' : 'bar', 'uri' : 'https://foo/bar.vba', 'type' : 'vba' })
  call s:assert.equals(neobundle#parser#path(
        \ 'https://foo/bar.vba.gz'),
        \ { 'name' : 'bar', 'uri' : 'https://foo/bar.vba.gz', 'type' : 'vba' })
  call s:assert.equals(neobundle#parser#path(
        \ 'http://foo/bar.vba.gz'),
        \ {})
endfunction

function! s:suite.default_options()
  let g:default_options_save = g:neobundle#default_options
  let g:neobundle#default_options =
        \ { 'rev' : {'type__update_style' : 'current'},
        \   '_' : {'type' : 'hg'} }

  let bundle = neobundle#parser#_init_bundle(
        \ 'Shougo/neocomplcache', ['', 'rev', {}])
  call s:assert.equals(bundle.type__update_style, 'current')

  let bundle2 = neobundle#parser#_init_bundle(
        \ 'Shougo/neocomplcache', [])
  call s:assert.equals(bundle2.type, 'hg')

  let g:neobundle#default_options = g:default_options_save
endfunction

function! s:suite.ssh_protocol()
  let bundle = neobundle#parser#_init_bundle(
        \ 'accountname/reponame', [{
        \ 'site' : 'github', 'type' : 'git', 'type__protocol' : 'ssh' }])
  call s:assert.equals(bundle.uri,
        \ 'git@github.com:accountname/reponame.git')

  let bundle = neobundle#parser#_init_bundle(
        \ 'accountname/reponame', [{
        \ 'site' : 'bitbucket', 'type' : 'hg', 'type__protocol' : 'ssh' }])
  call s:assert.equals(bundle.uri,
        \ 'ssh://hg@bitbucket.org/accountname/reponame')
{'fraction_non_alphanumeric': 0.19460217783419065, 'fraction_numerical': 0.003206627029193667, 'mean_word_length': 2.778394750126199, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 34, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 8, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7411298', 'n_tokens_mistral': 5881, 'n_tokens_neox': 5671, 'n_words': 632}