-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathtest-types.vim
More file actions
123 lines (108 loc) · 4.96 KB
/
test-types.vim
File metadata and controls
123 lines (108 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
"=============================================================================
" File: tests/lh/test-types.vim {{{1
" Author: Luc Hermitte <EMAIL:luc {dot} hermitte {at} gmail {dot} com>
" <URL:http://github.com/LucHermitte/lh-cpp>
" Version: 2.2.0.
let s:k_version = '220'
" Created: 15th Dec 2015
" Last Update: 15th Dec 2015
"------------------------------------------------------------------------
" Description:
" Test lh#cpp#types#...
"
"------------------------------------------------------------------------
" History: «history»
" TODO: «missing features»
" }}}1
"=============================================================================
UTSuite [lh-cpp] Testing lh/cpp/types.vim
runtime autoload/lh/cpp/types.vim
let s:cpo_save=&cpo
set cpo&vim
" SetUp {{{1
" Function: s:Setup() {{{3
function! s:Setup() abort
" SetMarker <+ +>
" it seems that playing with encodings messes vim execution through rspec
let b:marker_open = '<+'
let b:marker_close = '+>'
let b:last_encoding_used = &enc
AssertEquals( b:marker_open, '<+')
AssertRelation( lh#marker#version(), '>=' , 310)
AssertEquals(lh#marker#open(), '<+')
endfunction
" Tests {{{1
"------------------------------------------------------------------------
function! s:Test_none() " {{{2
let info = lh#cpp#types#get_info('invalid_type')
Assert get(info, 'unknown', 0)
AssertEquals(lh#cpp#types#get_includes('<invalid_type>'), [])
endfunction
"------------------------------------------------------------------------
function! s:Test_vector() " {{{2
let vector = lh#cpp#types#get_info('vector')
AssertEquals(vector.includes , ['<vector>'])
AssertEquals(vector.name , 'vector')
AssertEquals(vector.type , 'vector<%1>')
AssertEquals(vector.namespace , 'std')
AssertEquals(vector.typename_for_header('T'), 'std::vector<T>')
AssertEquals(vector.typename_for_header() , 'std::vector<<+T1+>>')
endfunction
"------------------------------------------------------------------------
function! s:Test_map() " {{{2
let map = lh#cpp#types#get_info('map')
AssertEquals(map.includes , ['<map>'])
AssertEquals(map.name , 'map')
AssertEquals(map.type , 'map<%1,%2>')
AssertEquals(map.namespace , 'std')
AssertEquals(map.typename_for_header('T', 'V'), 'std::map<T,V>')
AssertEquals(map.typename_for_header('T') , 'std::map<T,<+T2+>>')
AssertEquals(map.typename_for_header() , 'std::map<<+T1+>,<+T2+>>')
endfunction
"------------------------------------------------------------------------
function! s:Test_string() " {{{2
let string = lh#cpp#types#get_info('string')
AssertEquals(string.includes , ['<string>'])
AssertEquals(string.name , 'string')
AssertEquals(string.type , 'string')
AssertEquals(string.namespace , 'std')
AssertEquals(string.typename_for_header(), 'std::string')
endfunction
"------------------------------------------------------------------------
function! s:Test_chrono() " {{{2
let chrono_time_point = lh#cpp#types#get_info('chrono::time_point')
AssertEquals(chrono_time_point.includes , ['<chrono>'])
AssertEquals(chrono_time_point.name , 'chrono::time_point')
AssertEquals(chrono_time_point.type , 'chrono::time_point<%1>')
AssertEquals(chrono_time_point.namespace, 'std')
endfunction
"------------------------------------------------------------------------
function! s:Test_size_t() " {{{2
let size_t = lh#cpp#types#get_info('size_t')
AssertEquals(size_t.includes , ['<cstddef>', '<cstdio>', '<cstring>', '<ctime>', '<cstdlib>', '<cwchar>'])
AssertEquals(size_t.name , 'size_t')
AssertEquals(size_t.type , 'size_t')
AssertEquals(size_t.namespace, 'std')
endfunction
"------------------------------------------------------------------------
function! s:Test_noncopyable() " {{{2
let noncopyable = lh#cpp#types#get_info('noncopyable')
AssertEquals(noncopyable.includes , ['<boost/noncopyable.hpp>'])
AssertEquals(noncopyable.name , 'noncopyable')
AssertEquals(noncopyable.type , 'noncopyable')
AssertEquals(noncopyable.namespace, 'boost')
endfunction
"------------------------------------------------------------------------
function! s:Test_ptr_vector() " {{{2
let ptr_vector = lh#cpp#types#get_info('ptr_vector')
AssertEquals(ptr_vector.includes , ['<boost/ptr_container.hpp>', '<boost/ptr_container/ptr_vector.hpp>'])
AssertEquals(ptr_vector.name , 'ptr_vector')
AssertEquals(ptr_vector.type , 'ptr_vector<%1>')
AssertEquals(ptr_vector.namespace, 'boost')
endfunction
"------------------------------------------------------------------------
" }}}1
"------------------------------------------------------------------------
let &cpo=s:cpo_save
"=============================================================================
" vim600: set fdm=marker: