fix trailing space and long line

This commit is contained in:
Takayuki Shimizukawa
2014-10-09 23:53:33 +09:00
parent 95ada28440
commit da651089e7
12 changed files with 75 additions and 30 deletions
+24 -11
View File
@@ -27,7 +27,8 @@ def parse(name, string):
def check(name, input, output=None):
# first a simple check of the AST
if output == None: output = input
if output is None:
output = input
ast = parse(name, input)
res = text_type(ast)
if res != output:
@@ -36,7 +37,8 @@ def check(name, input, output=None):
print("Expected: ", output)
raise DefinitionError("")
ast.describe_signature([], 'lastIsName', None)
ast.prefixedName = ast.name # otherwise the get_id fails, it would be set in handle_signarue
ast.prefixedName = ast.name # otherwise the get_id fails, it would be set
# in handle_signarue
ast.get_id()
#print ".. %s:: %s" % (name, input)
@@ -49,7 +51,7 @@ def test_type_definitions():
check("type", "bool *volatile const b")
check("type", "bool *volatile const *b")
check("type", "bool &b")
check("type", "bool b[]")
check("type", "bool b[]")
check("type", "std::pair<int, int> coord")
check("type", "long long int foo")
check("type", 'std::vector<std::pair<std::string, long long>> module::blah')
@@ -57,12 +59,20 @@ def test_type_definitions():
check("type", "std::function<R(A1, A2, A3)> F")
check("type", "std::function<R(A1, A2, A3, As...)> F")
check("type", "MyContainer::const_iterator")
check("type", "public MyContainer::const_iterator", "MyContainer::const_iterator")
check('member', ' const std::string & name = 42', 'const std::string &name = 42')
check("type",
"public MyContainer::const_iterator",
"MyContainer::const_iterator")
check('member',
' const std::string & name = 42',
'const std::string &name = 42')
check('member', ' const std::string & name', 'const std::string &name')
check('member', ' const std::string & name [ n ]', 'const std::string &name[n]')
check('member', 'const std::vector< unsigned int, long> &name', 'const std::vector<unsigned int, long> &name')
check('member',
' const std::string & name [ n ]',
'const std::string &name[n]')
check('member',
'const std::vector< unsigned int, long> &name',
'const std::vector<unsigned int, long> &name')
check('member', 'module::myclass foo[n]')
check('function', 'operator bool() const')
@@ -76,8 +86,10 @@ def test_type_definitions():
check('function', 'int foo(const unsigned int j)')
check('function', 'int foo(const int *const ptr)')
check('function', 'module::myclass::operator std::vector<std::string>()')
check('function', 'void operator()(const boost::array<VertexID, 2> &v) const')
check('function', 'void operator()(const boost::array<VertexID, 2, "foo, bar"> &v) const')
check('function',
'void operator()(const boost::array<VertexID, 2> &v) const')
check('function',
'void operator()(const boost::array<VertexID, 2, "foo, bar"> &v) const')
check('function', 'MyClass::MyClass(MyClass::MyClass&&)')
check('function', 'constexpr int get_value()')
check('function', 'static constexpr int get_value()')
@@ -101,7 +113,8 @@ def test_type_definitions():
x = 'std::vector<std::pair<std::string, int>> &module::test(register ' \
'foo, bar[n], std::string baz = "foobar, blah, bleh") const = 0'
check('function', x)
check('function', 'int foo(Foo f = Foo(double(), std::make_pair(int(2), double(3.4))))')
check('function',
'int foo(Foo f = Foo(double(), std::make_pair(int(2), double(3.4))))')
check('function', 'int foo(A a = x(a))')
raises(DefinitionError, parse, 'function', 'int foo(B b=x(a)')
raises(DefinitionError, parse, 'function', 'int foo)C c=x(a))')