mypy: add None return types to functions that don't return a value
This commit is contained in:
parent
cd6d4f23f3
commit
9756025e2d
@ -9,7 +9,7 @@ from .options import ParserOptions
|
||||
from .simple import parse_file
|
||||
|
||||
|
||||
def dumpmain():
|
||||
def dumpmain() -> None:
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument("header")
|
||||
|
@ -46,7 +46,7 @@ def nondefault_repr(data):
|
||||
return _inner_repr(data)
|
||||
|
||||
|
||||
def gentest(infile: str, name: str, outfile: str, verbose: bool):
|
||||
def gentest(infile: str, name: str, outfile: str, verbose: bool) -> None:
|
||||
# Goal is to allow making a unit test as easy as running this dumper
|
||||
# on a file and copy/pasting this into a test
|
||||
|
||||
@ -64,7 +64,7 @@ def gentest(infile: str, name: str, outfile: str, verbose: bool):
|
||||
stmt = inspect.cleandoc(
|
||||
f'''
|
||||
|
||||
def test_{name}():
|
||||
def test_{name}() -> None:
|
||||
content = """
|
||||
{content}
|
||||
"""
|
||||
|
@ -544,7 +544,7 @@ class CxxParser:
|
||||
|
||||
return TemplateDecl(params)
|
||||
|
||||
def _parse_template(self, tok: LexToken, doxygen: typing.Optional[str]):
|
||||
def _parse_template(self, tok: LexToken, doxygen: typing.Optional[str]) -> None:
|
||||
|
||||
template = self._parse_template_decl()
|
||||
|
||||
@ -2128,7 +2128,7 @@ class CxxParser:
|
||||
template: typing.Optional[TemplateDecl],
|
||||
is_typedef: bool,
|
||||
is_friend: bool,
|
||||
):
|
||||
) -> None:
|
||||
tok = self._next_token_must_be("operator")
|
||||
|
||||
if is_typedef:
|
||||
|
@ -57,7 +57,7 @@ class ExternBlockState(State):
|
||||
super().__init__(parent)
|
||||
self.linkage = linkage
|
||||
|
||||
def _finish(self, visitor: "CxxVisitor"):
|
||||
def _finish(self, visitor: "CxxVisitor") -> None:
|
||||
visitor.on_extern_block_end(self)
|
||||
|
||||
|
||||
|
@ -185,7 +185,7 @@ class SimpleCxxVisitor:
|
||||
namespace: NamespaceScope
|
||||
block: Block
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self) -> None:
|
||||
self.namespace = NamespaceScope("")
|
||||
self.block = self.namespace
|
||||
|
||||
@ -259,7 +259,7 @@ class SimpleCxxVisitor:
|
||||
ns = UsingNamespace("::".join(namespace))
|
||||
self.block.using_ns.append(ns)
|
||||
|
||||
def on_using_alias(self, state: State, using: UsingAlias):
|
||||
def on_using_alias(self, state: State, using: UsingAlias) -> None:
|
||||
self.block.using_alias.append(using)
|
||||
|
||||
def on_using_declaration(self, state: State, using: UsingDecl) -> None:
|
||||
@ -288,7 +288,7 @@ class SimpleCxxVisitor:
|
||||
def on_class_method(self, state: ClassBlockState, method: Method) -> None:
|
||||
self.block.methods.append(method)
|
||||
|
||||
def on_class_friend(self, state: ClassBlockState, friend: FriendDecl):
|
||||
def on_class_friend(self, state: ClassBlockState, friend: FriendDecl) -> None:
|
||||
self.block.friends.append(friend)
|
||||
|
||||
def on_class_end(self, state: ClassBlockState) -> None:
|
||||
|
@ -119,7 +119,7 @@ class CxxVisitor(Protocol):
|
||||
using namespace std;
|
||||
"""
|
||||
|
||||
def on_using_alias(self, state: State, using: UsingAlias):
|
||||
def on_using_alias(self, state: State, using: UsingAlias) -> None:
|
||||
"""
|
||||
.. code-block:: c++
|
||||
|
||||
@ -171,7 +171,7 @@ class CxxVisitor(Protocol):
|
||||
Called when a field of a class is encountered
|
||||
"""
|
||||
|
||||
def on_class_friend(self, state: ClassBlockState, friend: FriendDecl):
|
||||
def on_class_friend(self, state: ClassBlockState, friend: FriendDecl) -> None:
|
||||
"""
|
||||
Called when a friend declaration is encountered
|
||||
"""
|
||||
|
@ -28,7 +28,7 @@ from cxxheaderparser.simple import (
|
||||
)
|
||||
|
||||
|
||||
def test_attributes_everywhere():
|
||||
def test_attributes_everywhere() -> None:
|
||||
# TODO: someday we'll actually support storing attributes,
|
||||
# but for now just make sure they don't get in the way
|
||||
|
||||
@ -124,7 +124,7 @@ def test_attributes_everywhere():
|
||||
)
|
||||
|
||||
|
||||
def test_attributes_gcc_enum_packed():
|
||||
def test_attributes_gcc_enum_packed() -> None:
|
||||
content = """
|
||||
enum Wheat {
|
||||
w1,
|
||||
@ -152,7 +152,7 @@ def test_attributes_gcc_enum_packed():
|
||||
)
|
||||
|
||||
|
||||
def test_friendly_declspec():
|
||||
def test_friendly_declspec() -> None:
|
||||
content = """
|
||||
struct D {
|
||||
friend __declspec(dllexport) void my_friend();
|
||||
@ -205,7 +205,7 @@ def test_friendly_declspec():
|
||||
)
|
||||
|
||||
|
||||
def test_declspec_template():
|
||||
def test_declspec_template() -> None:
|
||||
content = """
|
||||
template <class T2>
|
||||
__declspec(deprecated("message"))
|
||||
|
@ -38,7 +38,7 @@ from cxxheaderparser.simple import (
|
||||
)
|
||||
|
||||
|
||||
def test_class_member_spec_1():
|
||||
def test_class_member_spec_1() -> None:
|
||||
content = """
|
||||
class S {
|
||||
int d1; // non-static data member
|
||||
@ -266,7 +266,7 @@ def test_class_member_spec_1():
|
||||
)
|
||||
|
||||
|
||||
def test_class_member_spec_2():
|
||||
def test_class_member_spec_2() -> None:
|
||||
content = """
|
||||
class M {
|
||||
std::size_t C;
|
||||
@ -437,7 +437,7 @@ def test_class_member_spec_2():
|
||||
)
|
||||
|
||||
|
||||
def test_class_member_spec_3():
|
||||
def test_class_member_spec_3() -> None:
|
||||
content = """
|
||||
class S {
|
||||
public:
|
||||
@ -513,7 +513,7 @@ def test_class_member_spec_3():
|
||||
)
|
||||
|
||||
|
||||
def test_class_using():
|
||||
def test_class_using() -> None:
|
||||
content = """
|
||||
class Base {
|
||||
protected:
|
||||
@ -586,7 +586,7 @@ def test_class_using():
|
||||
)
|
||||
|
||||
|
||||
def test_class_member_spec_6():
|
||||
def test_class_member_spec_6() -> None:
|
||||
content = """
|
||||
struct S {
|
||||
template<typename T>
|
||||
@ -688,7 +688,7 @@ def test_class_member_spec_6():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fn_default_params():
|
||||
def test_class_fn_default_params() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
class Hen
|
||||
@ -796,7 +796,7 @@ def test_class_fn_default_params():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fn_inline_virtual():
|
||||
def test_class_fn_inline_virtual() -> None:
|
||||
content = """
|
||||
class B {
|
||||
public:
|
||||
@ -834,7 +834,7 @@ def test_class_fn_inline_virtual():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fn_pure_virtual_const():
|
||||
def test_class_fn_pure_virtual_const() -> None:
|
||||
content = """
|
||||
class StoneClass {
|
||||
virtual int getNum2() const = 0;
|
||||
@ -884,7 +884,7 @@ def test_class_fn_pure_virtual_const():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fn_return_global_ns():
|
||||
def test_class_fn_return_global_ns() -> None:
|
||||
content = """
|
||||
struct Avacado {
|
||||
uint8_t foo() { return 4; }
|
||||
@ -935,7 +935,7 @@ def test_class_fn_return_global_ns():
|
||||
)
|
||||
|
||||
|
||||
def test_class_ns_class():
|
||||
def test_class_ns_class() -> None:
|
||||
content = """
|
||||
namespace ns {
|
||||
class N;
|
||||
@ -976,7 +976,7 @@ def test_class_ns_class():
|
||||
)
|
||||
|
||||
|
||||
def test_class_ns_w_base():
|
||||
def test_class_ns_w_base() -> None:
|
||||
content = """
|
||||
class Herb::Cilantro : public Plant {};
|
||||
"""
|
||||
@ -1007,7 +1007,7 @@ def test_class_ns_w_base():
|
||||
)
|
||||
|
||||
|
||||
def test_class_inner_class():
|
||||
def test_class_inner_class() -> None:
|
||||
content = """
|
||||
class C {
|
||||
class Inner {};
|
||||
@ -1042,7 +1042,7 @@ def test_class_inner_class():
|
||||
)
|
||||
|
||||
|
||||
def test_class_inner_fwd_class():
|
||||
def test_class_inner_fwd_class() -> None:
|
||||
content = """
|
||||
class C {
|
||||
class N;
|
||||
@ -1083,7 +1083,7 @@ def test_class_inner_fwd_class():
|
||||
)
|
||||
|
||||
|
||||
def test_class_inner_var_access():
|
||||
def test_class_inner_var_access() -> None:
|
||||
content = """
|
||||
class Bug_3488053 {
|
||||
public:
|
||||
@ -1133,7 +1133,7 @@ def test_class_inner_var_access():
|
||||
)
|
||||
|
||||
|
||||
def test_class_ns_and_inner():
|
||||
def test_class_ns_and_inner() -> None:
|
||||
content = """
|
||||
namespace RoosterNamespace {
|
||||
class RoosterOuterClass {
|
||||
@ -1275,7 +1275,7 @@ def test_class_ns_and_inner():
|
||||
)
|
||||
|
||||
|
||||
def test_class_struct_access():
|
||||
def test_class_struct_access() -> None:
|
||||
content = """
|
||||
struct SampleStruct {
|
||||
unsigned int meth();
|
||||
@ -1325,7 +1325,7 @@ def test_class_struct_access():
|
||||
)
|
||||
|
||||
|
||||
def test_class_volatile_move_deleted_fn():
|
||||
def test_class_volatile_move_deleted_fn() -> None:
|
||||
content = """
|
||||
struct C {
|
||||
void foo() volatile && = delete;
|
||||
@ -1363,7 +1363,7 @@ def test_class_volatile_move_deleted_fn():
|
||||
)
|
||||
|
||||
|
||||
def test_class_bitfield_1():
|
||||
def test_class_bitfield_1() -> None:
|
||||
content = """
|
||||
struct S {
|
||||
// will usually occupy 2 bytes:
|
||||
@ -1441,7 +1441,7 @@ def test_class_bitfield_1():
|
||||
)
|
||||
|
||||
|
||||
def test_class_bitfield_2():
|
||||
def test_class_bitfield_2() -> None:
|
||||
content = """
|
||||
struct HAL_ControlWord {
|
||||
int x : 1;
|
||||
@ -1521,7 +1521,7 @@ def test_class_bitfield_2():
|
||||
)
|
||||
|
||||
|
||||
def test_class_anon_struct_as_globalvar():
|
||||
def test_class_anon_struct_as_globalvar() -> None:
|
||||
content = """
|
||||
struct {
|
||||
int m;
|
||||
@ -1575,7 +1575,7 @@ def test_class_anon_struct_as_globalvar():
|
||||
)
|
||||
|
||||
|
||||
def test_class_anon_struct_as_classvar():
|
||||
def test_class_anon_struct_as_classvar() -> None:
|
||||
content = """
|
||||
struct AnonHolderClass {
|
||||
struct {
|
||||
@ -1633,7 +1633,7 @@ def test_class_anon_struct_as_classvar():
|
||||
)
|
||||
|
||||
|
||||
def test_initializer_with_initializer_list_1():
|
||||
def test_initializer_with_initializer_list_1() -> None:
|
||||
content = """
|
||||
struct ComplexInit : SomeBase {
|
||||
ComplexInit(int i) : m_stuff{i, 2} { auto i = something(); }
|
||||
@ -1730,7 +1730,7 @@ def test_initializer_with_initializer_list_1():
|
||||
)
|
||||
|
||||
|
||||
def test_initializer_with_initializer_list_2():
|
||||
def test_initializer_with_initializer_list_2() -> None:
|
||||
content = """
|
||||
template <typename T> class future final {
|
||||
public:
|
||||
@ -1804,7 +1804,7 @@ def test_initializer_with_initializer_list_2():
|
||||
)
|
||||
|
||||
|
||||
def test_class_with_arrays():
|
||||
def test_class_with_arrays() -> None:
|
||||
content = """
|
||||
const int MAX_ITEM = 7;
|
||||
class Bird {
|
||||
@ -1875,7 +1875,7 @@ def test_class_with_arrays():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fn_inline_impl():
|
||||
def test_class_fn_inline_impl() -> None:
|
||||
content = """
|
||||
class Monkey {
|
||||
private:
|
||||
@ -1929,7 +1929,7 @@ def test_class_fn_inline_impl():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fn_virtual_final_override():
|
||||
def test_class_fn_virtual_final_override() -> None:
|
||||
content = """
|
||||
struct Lemon {
|
||||
virtual void foo() final;
|
||||
@ -2020,7 +2020,7 @@ def test_class_fn_virtual_final_override():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fn_return_class():
|
||||
def test_class_fn_return_class() -> None:
|
||||
content = """
|
||||
class Peach {
|
||||
int abc;
|
||||
@ -2144,7 +2144,7 @@ def test_class_fn_return_class():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fn_template_impl():
|
||||
def test_class_fn_template_impl() -> None:
|
||||
content = """
|
||||
class Owl {
|
||||
private:
|
||||
@ -2231,7 +2231,7 @@ def test_class_fn_template_impl():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fn_inline_template_impl():
|
||||
def test_class_fn_inline_template_impl() -> None:
|
||||
content = """
|
||||
class Chicken {
|
||||
template <typename T> static T Get();
|
||||
@ -2287,7 +2287,7 @@ def test_class_fn_inline_template_impl():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fn_explicit_constructors():
|
||||
def test_class_fn_explicit_constructors() -> None:
|
||||
content = """
|
||||
class Lizzard {
|
||||
Lizzard();
|
||||
@ -2337,7 +2337,7 @@ def test_class_fn_explicit_constructors():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fn_default_constructor():
|
||||
def test_class_fn_default_constructor() -> None:
|
||||
content = """
|
||||
class DefaultConstDest {
|
||||
public:
|
||||
@ -2374,7 +2374,7 @@ def test_class_fn_default_constructor():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fn_delete_constructor():
|
||||
def test_class_fn_delete_constructor() -> None:
|
||||
content = """
|
||||
class A {
|
||||
public:
|
||||
@ -2408,7 +2408,7 @@ def test_class_fn_delete_constructor():
|
||||
)
|
||||
|
||||
|
||||
def test_class_multi_vars():
|
||||
def test_class_multi_vars() -> None:
|
||||
content = """
|
||||
class Grape {
|
||||
public:
|
||||
@ -2580,7 +2580,7 @@ def test_class_multi_vars():
|
||||
)
|
||||
|
||||
|
||||
def test_class_static_const_var_expr():
|
||||
def test_class_static_const_var_expr() -> None:
|
||||
content = """
|
||||
class PandaClass {
|
||||
static const int CONST_A = (1 << 7) - 1;
|
||||
@ -2648,7 +2648,7 @@ def test_class_static_const_var_expr():
|
||||
)
|
||||
|
||||
|
||||
def test_class_fwd_struct():
|
||||
def test_class_fwd_struct() -> None:
|
||||
content = """
|
||||
class PotatoClass {
|
||||
struct FwdStruct;
|
||||
@ -2720,7 +2720,7 @@ def test_class_fwd_struct():
|
||||
)
|
||||
|
||||
|
||||
def test_class_multi_array():
|
||||
def test_class_multi_array() -> None:
|
||||
content = """
|
||||
struct Picture {
|
||||
char name[25];
|
||||
@ -2777,7 +2777,7 @@ def test_class_multi_array():
|
||||
)
|
||||
|
||||
|
||||
def test_class_noexcept():
|
||||
def test_class_noexcept() -> None:
|
||||
content = """
|
||||
struct Grackle {
|
||||
void no_noexcept();
|
||||
@ -2919,7 +2919,7 @@ def test_class_noexcept():
|
||||
)
|
||||
|
||||
|
||||
def test_class_volatile():
|
||||
def test_class_volatile() -> None:
|
||||
content = """
|
||||
class Foo
|
||||
{
|
||||
@ -2960,7 +2960,7 @@ def test_class_volatile():
|
||||
)
|
||||
|
||||
|
||||
def test_class_mutable():
|
||||
def test_class_mutable() -> None:
|
||||
content = """
|
||||
class Foo
|
||||
{
|
||||
|
@ -21,7 +21,7 @@ from cxxheaderparser.simple import (
|
||||
)
|
||||
|
||||
|
||||
def test_class_private_base():
|
||||
def test_class_private_base() -> None:
|
||||
content = """
|
||||
namespace Citrus
|
||||
{
|
||||
@ -108,7 +108,7 @@ def test_class_private_base():
|
||||
)
|
||||
|
||||
|
||||
def test_class_virtual_base():
|
||||
def test_class_virtual_base() -> None:
|
||||
content = """
|
||||
class BaseMangoClass {};
|
||||
class MangoClass : virtual public BaseMangoClass {};
|
||||
@ -148,7 +148,7 @@ def test_class_virtual_base():
|
||||
)
|
||||
|
||||
|
||||
def test_class_multiple_base_with_virtual():
|
||||
def test_class_multiple_base_with_virtual() -> None:
|
||||
content = """
|
||||
class BlueJay : public Bird, public virtual Food {
|
||||
public:
|
||||
@ -193,7 +193,7 @@ def test_class_multiple_base_with_virtual():
|
||||
)
|
||||
|
||||
|
||||
def test_class_base_specialized():
|
||||
def test_class_base_specialized() -> None:
|
||||
content = """
|
||||
class Pea : public Vegetable<Green> {
|
||||
int i;
|
||||
|
@ -38,7 +38,7 @@ from cxxheaderparser.simple import (
|
||||
)
|
||||
|
||||
|
||||
def test_doxygen_class():
|
||||
def test_doxygen_class() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
|
||||
@ -107,7 +107,7 @@ def test_doxygen_class():
|
||||
)
|
||||
|
||||
|
||||
def test_doxygen_class_template():
|
||||
def test_doxygen_class_template() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
|
||||
@ -136,7 +136,7 @@ def test_doxygen_class_template():
|
||||
)
|
||||
|
||||
|
||||
def test_doxygen_enum():
|
||||
def test_doxygen_enum() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
|
||||
@ -182,7 +182,7 @@ def test_doxygen_enum():
|
||||
)
|
||||
|
||||
|
||||
def test_doxygen_fn_3slash():
|
||||
def test_doxygen_fn_3slash() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
|
||||
@ -209,7 +209,7 @@ def test_doxygen_fn_3slash():
|
||||
)
|
||||
|
||||
|
||||
def test_doxygen_fn_cstyle():
|
||||
def test_doxygen_fn_cstyle() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
|
||||
@ -238,7 +238,7 @@ def test_doxygen_fn_cstyle():
|
||||
)
|
||||
|
||||
|
||||
def test_doxygen_var_above():
|
||||
def test_doxygen_var_above() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
|
||||
@ -267,7 +267,7 @@ def test_doxygen_var_above():
|
||||
)
|
||||
|
||||
|
||||
def test_doxygen_var_after():
|
||||
def test_doxygen_var_after() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
|
||||
|
@ -25,7 +25,7 @@ from cxxheaderparser.simple import (
|
||||
)
|
||||
|
||||
|
||||
def test_basic_enum():
|
||||
def test_basic_enum() -> None:
|
||||
content = """
|
||||
enum Foo {
|
||||
A,
|
||||
@ -48,7 +48,7 @@ def test_basic_enum():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_w_expr():
|
||||
def test_enum_w_expr() -> None:
|
||||
content = """
|
||||
enum Foo {
|
||||
A = (1 / 2),
|
||||
@ -85,7 +85,7 @@ def test_enum_w_expr():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_w_multiline_expr():
|
||||
def test_enum_w_multiline_expr() -> None:
|
||||
content = r"""
|
||||
// clang-format off
|
||||
enum Author
|
||||
@ -139,7 +139,7 @@ def test_enum_w_multiline_expr():
|
||||
)
|
||||
|
||||
|
||||
def test_basic_enum_class():
|
||||
def test_basic_enum_class() -> None:
|
||||
content = """
|
||||
enum class BE { BEX };
|
||||
"""
|
||||
@ -159,7 +159,7 @@ def test_basic_enum_class():
|
||||
)
|
||||
|
||||
|
||||
def test_basic_enum_struct():
|
||||
def test_basic_enum_struct() -> None:
|
||||
content = """
|
||||
enum struct BE { BEX };
|
||||
"""
|
||||
@ -179,7 +179,7 @@ def test_basic_enum_struct():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_base():
|
||||
def test_enum_base() -> None:
|
||||
content = """
|
||||
enum class E : int {};
|
||||
"""
|
||||
@ -203,7 +203,7 @@ def test_enum_base():
|
||||
# instances
|
||||
|
||||
|
||||
def test_enum_instance_1():
|
||||
def test_enum_instance_1() -> None:
|
||||
content = """
|
||||
enum class BE { BEX } be1;
|
||||
"""
|
||||
@ -233,7 +233,7 @@ def test_enum_instance_1():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_instance_2():
|
||||
def test_enum_instance_2() -> None:
|
||||
content = """
|
||||
enum class BE { BEX } be1, *be2;
|
||||
"""
|
||||
@ -277,7 +277,7 @@ def test_enum_instance_2():
|
||||
# bases in namespaces
|
||||
|
||||
|
||||
def test_enum_base_in_ns():
|
||||
def test_enum_base_in_ns() -> None:
|
||||
content = """
|
||||
namespace EN {
|
||||
typedef int EINT;
|
||||
@ -322,7 +322,7 @@ def test_enum_base_in_ns():
|
||||
# forward declarations
|
||||
|
||||
|
||||
def test_enum_fwd():
|
||||
def test_enum_fwd() -> None:
|
||||
content = """
|
||||
enum class BE1;
|
||||
enum class BE2 : EN::EINT;
|
||||
@ -350,7 +350,7 @@ def test_enum_fwd():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_private_in_class():
|
||||
def test_enum_private_in_class() -> None:
|
||||
content = """
|
||||
|
||||
class C {
|
||||
@ -383,7 +383,7 @@ def test_enum_private_in_class():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_public_in_class():
|
||||
def test_enum_public_in_class() -> None:
|
||||
content = """
|
||||
|
||||
class C {
|
||||
@ -417,7 +417,7 @@ def test_enum_public_in_class():
|
||||
)
|
||||
|
||||
|
||||
def test_default_enum():
|
||||
def test_default_enum() -> None:
|
||||
content = """
|
||||
class A {
|
||||
enum {
|
||||
@ -497,7 +497,7 @@ def test_default_enum():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_template_vals():
|
||||
def test_enum_template_vals() -> None:
|
||||
content = """
|
||||
enum {
|
||||
IsRandomAccess = std::is_base_of<std::random_access_iterator_tag,
|
||||
@ -559,7 +559,7 @@ def test_enum_template_vals():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_fn():
|
||||
def test_enum_fn() -> None:
|
||||
content = """
|
||||
enum E {
|
||||
VALUE,
|
||||
|
@ -31,7 +31,7 @@ from cxxheaderparser.simple import (
|
||||
)
|
||||
|
||||
|
||||
def test_fn_returns_class():
|
||||
def test_fn_returns_class() -> None:
|
||||
content = """
|
||||
class X *fn1();
|
||||
struct Y fn2();
|
||||
@ -77,7 +77,7 @@ def test_fn_returns_class():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_returns_typename():
|
||||
def test_fn_returns_typename() -> None:
|
||||
content = """
|
||||
typename ns::X fn();
|
||||
"""
|
||||
@ -104,7 +104,7 @@ def test_fn_returns_typename():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_returns_typename_const():
|
||||
def test_fn_returns_typename_const() -> None:
|
||||
content = """
|
||||
const typename ns::X fn();
|
||||
"""
|
||||
@ -132,7 +132,7 @@ def test_fn_returns_typename_const():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_pointer_params():
|
||||
def test_fn_pointer_params() -> None:
|
||||
content = """
|
||||
int fn1(int *);
|
||||
int fn2(int *p);
|
||||
@ -201,7 +201,7 @@ def test_fn_pointer_params():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_void_is_no_params():
|
||||
def test_fn_void_is_no_params() -> None:
|
||||
content = """
|
||||
int fn(void);
|
||||
"""
|
||||
@ -222,7 +222,7 @@ def test_fn_void_is_no_params():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_array_param():
|
||||
def test_fn_array_param() -> None:
|
||||
content = """
|
||||
void fn(int array[]);
|
||||
"""
|
||||
@ -255,7 +255,7 @@ def test_fn_array_param():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_typename_param():
|
||||
def test_fn_typename_param() -> None:
|
||||
content = """
|
||||
void MethodA(const mynamespace::SomeObject &x,
|
||||
typename mynamespace::SomeObject * = 0);
|
||||
@ -307,7 +307,7 @@ def test_fn_typename_param():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_weird_refs():
|
||||
def test_fn_weird_refs() -> None:
|
||||
content = """
|
||||
int aref(int(&x));
|
||||
void ptr_ref(int(*&name));
|
||||
@ -382,7 +382,7 @@ def test_fn_weird_refs():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_too_many_parens():
|
||||
def test_fn_too_many_parens() -> None:
|
||||
content = """
|
||||
int fn1(int (x));
|
||||
void (fn2 (int (*const (name))));
|
||||
@ -439,7 +439,7 @@ void (__stdcall * fn)
|
||||
"""
|
||||
|
||||
|
||||
def test_fn_same_line():
|
||||
def test_fn_same_line() -> None:
|
||||
# multiple functions on the same line
|
||||
content = """
|
||||
void fn1(), fn2();
|
||||
@ -487,7 +487,7 @@ def test_fn_same_line():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_auto_template():
|
||||
def test_fn_auto_template() -> None:
|
||||
content = """
|
||||
template<class T, class U>
|
||||
auto add(T t, U u) { return t + u; }
|
||||
@ -527,7 +527,7 @@ def test_fn_auto_template():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_template_ptr():
|
||||
def test_fn_template_ptr() -> None:
|
||||
content = """
|
||||
std::vector<Pointer *> *fn(std::vector<Pointer *> *ps);
|
||||
"""
|
||||
@ -607,7 +607,7 @@ def test_fn_template_ptr():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_with_impl():
|
||||
def test_fn_with_impl() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
void termite(void)
|
||||
@ -634,7 +634,7 @@ def test_fn_with_impl():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_return_std_function():
|
||||
def test_fn_return_std_function() -> None:
|
||||
content = """
|
||||
std::function<void(int)> fn();
|
||||
"""
|
||||
@ -700,7 +700,7 @@ def test_fn_return_std_function():
|
||||
assert data2 == expected
|
||||
|
||||
|
||||
def test_fn_return_std_function_trailing():
|
||||
def test_fn_return_std_function_trailing() -> None:
|
||||
content = """
|
||||
std::function<auto(int)->int> fn();
|
||||
"""
|
||||
@ -759,7 +759,7 @@ def test_fn_return_std_function_trailing():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_trailing_return_simple():
|
||||
def test_fn_trailing_return_simple() -> None:
|
||||
content = """
|
||||
auto fn() -> int;
|
||||
"""
|
||||
@ -781,7 +781,7 @@ def test_fn_trailing_return_simple():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_trailing_return_std_function():
|
||||
def test_fn_trailing_return_std_function() -> None:
|
||||
content = """
|
||||
auto fn() -> std::function<int()>;
|
||||
"""
|
||||
@ -828,7 +828,7 @@ def test_fn_trailing_return_std_function():
|
||||
)
|
||||
|
||||
|
||||
def test_inline_volatile_fn():
|
||||
def test_inline_volatile_fn() -> None:
|
||||
content = """
|
||||
inline int Standard_Atomic_Increment (volatile int* theValue);
|
||||
"""
|
||||
@ -864,7 +864,7 @@ def test_inline_volatile_fn():
|
||||
)
|
||||
|
||||
|
||||
def test_method_w_reference():
|
||||
def test_method_w_reference() -> None:
|
||||
content = """
|
||||
struct StreamBuffer
|
||||
{
|
||||
@ -947,7 +947,7 @@ def test_method_w_reference():
|
||||
)
|
||||
|
||||
|
||||
def test_fn_w_mvreference():
|
||||
def test_fn_w_mvreference() -> None:
|
||||
content = """
|
||||
void fn1(int && (*)(int));
|
||||
|
||||
@ -996,7 +996,7 @@ def test_fn_w_mvreference():
|
||||
)
|
||||
|
||||
|
||||
def test_msvc_conventions():
|
||||
def test_msvc_conventions() -> None:
|
||||
content = """
|
||||
void __cdecl fn();
|
||||
typedef const char* (__stdcall *wglGetExtensionsStringARB_t)(HDC theDeviceContext);
|
||||
|
@ -23,7 +23,7 @@ from cxxheaderparser.simple import (
|
||||
)
|
||||
|
||||
# friends
|
||||
def test_various_friends():
|
||||
def test_various_friends() -> None:
|
||||
content = """
|
||||
class FX {
|
||||
public:
|
||||
@ -170,7 +170,7 @@ def test_various_friends():
|
||||
)
|
||||
|
||||
|
||||
def test_more_friends():
|
||||
def test_more_friends() -> None:
|
||||
content = """
|
||||
template <typename T> struct X { static int x; };
|
||||
|
||||
@ -285,7 +285,7 @@ def test_more_friends():
|
||||
)
|
||||
|
||||
|
||||
def test_friend_type_no_class():
|
||||
def test_friend_type_no_class() -> None:
|
||||
content = """
|
||||
class DogClass;
|
||||
class CatClass {
|
||||
@ -327,7 +327,7 @@ def test_friend_type_no_class():
|
||||
)
|
||||
|
||||
|
||||
def test_friend_with_impl():
|
||||
def test_friend_with_impl() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
class Garlic {
|
||||
|
@ -28,7 +28,7 @@ from cxxheaderparser.simple import (
|
||||
#
|
||||
|
||||
|
||||
def test_define():
|
||||
def test_define() -> None:
|
||||
content = """
|
||||
#define simple
|
||||
#define complex(thing) stuff(thing)
|
||||
@ -45,7 +45,7 @@ def test_define():
|
||||
)
|
||||
|
||||
|
||||
def test_includes():
|
||||
def test_includes() -> None:
|
||||
content = """
|
||||
#include <global.h>
|
||||
#include "local.h"
|
||||
@ -55,7 +55,7 @@ def test_includes():
|
||||
assert data == ParsedData(includes=[Include("<global.h>"), Include('"local.h"')])
|
||||
|
||||
|
||||
def test_pragma():
|
||||
def test_pragma() -> None:
|
||||
content = """
|
||||
|
||||
#pragma once
|
||||
@ -71,7 +71,7 @@ def test_pragma():
|
||||
#
|
||||
|
||||
|
||||
def test_extern_c():
|
||||
def test_extern_c() -> None:
|
||||
content = """
|
||||
extern "C" {
|
||||
int x;
|
||||
@ -101,7 +101,7 @@ def test_extern_c():
|
||||
)
|
||||
|
||||
|
||||
def test_misc_extern_inline():
|
||||
def test_misc_extern_inline() -> None:
|
||||
content = """
|
||||
extern "C++" {
|
||||
inline HAL_Value HAL_GetSimValue(HAL_SimValueHandle handle) {
|
||||
@ -143,7 +143,7 @@ def test_misc_extern_inline():
|
||||
#
|
||||
|
||||
|
||||
def test_static_assert_1():
|
||||
def test_static_assert_1() -> None:
|
||||
# static_assert should be ignored
|
||||
content = """
|
||||
static_assert(x == 1);
|
||||
@ -153,7 +153,7 @@ def test_static_assert_1():
|
||||
assert data == ParsedData()
|
||||
|
||||
|
||||
def test_static_assert_2():
|
||||
def test_static_assert_2() -> None:
|
||||
# static_assert should be ignored
|
||||
content = """
|
||||
static_assert(sizeof(int) == 4,
|
||||
@ -165,7 +165,7 @@ def test_static_assert_2():
|
||||
assert data == ParsedData()
|
||||
|
||||
|
||||
def test_comment_eof():
|
||||
def test_comment_eof() -> None:
|
||||
content = """
|
||||
namespace a {} // namespace a"""
|
||||
data = parse_string(content, cleandoc=True)
|
||||
@ -175,7 +175,7 @@ def test_comment_eof():
|
||||
)
|
||||
|
||||
|
||||
def test_final():
|
||||
def test_final() -> None:
|
||||
content = """
|
||||
// ok here
|
||||
int fn(const int final);
|
||||
|
@ -16,7 +16,7 @@ from cxxheaderparser.simple import (
|
||||
)
|
||||
|
||||
|
||||
def test_dups_in_different_ns():
|
||||
def test_dups_in_different_ns() -> None:
|
||||
content = """
|
||||
|
||||
namespace {
|
||||
@ -58,7 +58,7 @@ def test_dups_in_different_ns():
|
||||
)
|
||||
|
||||
|
||||
def test_correct_ns():
|
||||
def test_correct_ns() -> None:
|
||||
content = """
|
||||
namespace a::b::c {
|
||||
int i1;
|
||||
|
@ -18,7 +18,7 @@ from cxxheaderparser.simple import (
|
||||
)
|
||||
|
||||
|
||||
def test_class_operators():
|
||||
def test_class_operators() -> None:
|
||||
content = r"""
|
||||
class OperatorClass {
|
||||
public:
|
||||
@ -554,7 +554,7 @@ def test_class_operators():
|
||||
)
|
||||
|
||||
|
||||
def test_conversion_operators():
|
||||
def test_conversion_operators() -> None:
|
||||
content = """
|
||||
|
||||
class Foo
|
||||
|
@ -29,7 +29,7 @@ from cxxheaderparser.types import (
|
||||
from cxxheaderparser.simple import ClassScope, NamespaceScope, ParsedData, parse_string
|
||||
|
||||
|
||||
def test_template_base_template_ns():
|
||||
def test_template_base_template_ns() -> None:
|
||||
content = """
|
||||
class A : public B<int, int>::C {};
|
||||
"""
|
||||
@ -89,7 +89,7 @@ def test_template_base_template_ns():
|
||||
)
|
||||
|
||||
|
||||
def test_template_non_type_various():
|
||||
def test_template_non_type_various() -> None:
|
||||
content = """
|
||||
// simple non-type template parameter
|
||||
template <int N> struct S { int a[N]; };
|
||||
@ -257,7 +257,7 @@ def test_template_non_type_various():
|
||||
)
|
||||
|
||||
|
||||
def test_template_dependent_nontype_default():
|
||||
def test_template_dependent_nontype_default() -> None:
|
||||
content = """
|
||||
template <class T, typename T::type n = 0> class X;
|
||||
"""
|
||||
@ -293,7 +293,7 @@ def test_template_dependent_nontype_default():
|
||||
)
|
||||
|
||||
|
||||
def test_template_optional_names():
|
||||
def test_template_optional_names() -> None:
|
||||
content = """
|
||||
template <class> class My_vector;
|
||||
template <class = void> struct My_op_functor;
|
||||
@ -337,7 +337,7 @@ def test_template_optional_names():
|
||||
)
|
||||
|
||||
|
||||
def test_template_template_template():
|
||||
def test_template_template_template() -> None:
|
||||
content = """
|
||||
template<typename T> struct eval; // primary template
|
||||
|
||||
@ -438,7 +438,7 @@ def test_template_template_template():
|
||||
)
|
||||
|
||||
|
||||
def test_template_static_var():
|
||||
def test_template_static_var() -> None:
|
||||
content = """
|
||||
template <typename T>
|
||||
struct X {
|
||||
@ -510,7 +510,7 @@ def test_template_static_var():
|
||||
)
|
||||
|
||||
|
||||
def test_template_fn_template():
|
||||
def test_template_fn_template() -> None:
|
||||
content = """
|
||||
class S {
|
||||
template <typename Allocator> StringRef copy(Allocator &A) const {
|
||||
@ -574,7 +574,7 @@ def test_template_fn_template():
|
||||
)
|
||||
|
||||
|
||||
def test_template_fn_param_initializer():
|
||||
def test_template_fn_param_initializer() -> None:
|
||||
content = """
|
||||
template <typename T, typename U>
|
||||
void fn(something<T, U> s = something<T, U>{1, 2, 3});
|
||||
@ -658,7 +658,7 @@ def test_template_fn_param_initializer():
|
||||
)
|
||||
|
||||
|
||||
def test_template_huge():
|
||||
def test_template_huge() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
class AlmondClass
|
||||
@ -872,7 +872,7 @@ def test_template_huge():
|
||||
)
|
||||
|
||||
|
||||
def test_template_specialized():
|
||||
def test_template_specialized() -> None:
|
||||
content = """
|
||||
template <> class FruitFly<int> : public Fly {};
|
||||
"""
|
||||
@ -920,7 +920,7 @@ def test_template_specialized():
|
||||
)
|
||||
|
||||
|
||||
def test_template_class_defaults():
|
||||
def test_template_class_defaults() -> None:
|
||||
content = """
|
||||
template <typename VALUE, typename VALUE_SET_ITERATOR,
|
||||
typename ACCESSOR = Raddish::SimpleAccessor<VALUE, VALUE_SET_ITERATOR>>
|
||||
@ -1068,7 +1068,7 @@ def test_template_class_defaults():
|
||||
)
|
||||
|
||||
|
||||
def test_template_many_packs():
|
||||
def test_template_many_packs() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
|
||||
@ -1651,7 +1651,7 @@ def test_template_many_packs():
|
||||
)
|
||||
|
||||
|
||||
def test_template_specialized_fn_typename():
|
||||
def test_template_specialized_fn_typename() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
struct T{};
|
||||
@ -1723,7 +1723,7 @@ def test_template_specialized_fn_typename():
|
||||
)
|
||||
|
||||
|
||||
def test_template_specialized_fn_typename_template():
|
||||
def test_template_specialized_fn_typename_template() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
template <typename X>
|
||||
|
@ -2,6 +2,7 @@ import pytest
|
||||
|
||||
from cxxheaderparser.lexer import Lexer
|
||||
from cxxheaderparser.tokfmt import tokfmt
|
||||
from cxxheaderparser.types import Token
|
||||
|
||||
|
||||
@pytest.mark.parametrize(
|
||||
@ -34,7 +35,7 @@ from cxxheaderparser.tokfmt import tokfmt
|
||||
"operator>=",
|
||||
],
|
||||
)
|
||||
def test_tokfmt(instr):
|
||||
def test_tokfmt(instr: str) -> None:
|
||||
"""
|
||||
Each input string is exactly what the output of tokfmt should be
|
||||
"""
|
||||
@ -47,6 +48,6 @@ def test_tokfmt(instr):
|
||||
if not tok:
|
||||
break
|
||||
|
||||
toks.append(tok)
|
||||
toks.append(Token(tok.value, tok.type))
|
||||
|
||||
assert tokfmt(toks) == instr
|
||||
|
@ -26,7 +26,7 @@ from cxxheaderparser.types import (
|
||||
from cxxheaderparser.simple import ClassScope, NamespaceScope, ParsedData, parse_string
|
||||
|
||||
|
||||
def test_simple_typedef():
|
||||
def test_simple_typedef() -> None:
|
||||
content = """
|
||||
typedef std::vector<int> IntVector;
|
||||
"""
|
||||
@ -68,7 +68,7 @@ def test_simple_typedef():
|
||||
)
|
||||
|
||||
|
||||
def test_struct_typedef_1():
|
||||
def test_struct_typedef_1() -> None:
|
||||
content = """
|
||||
typedef struct {
|
||||
int m;
|
||||
@ -122,7 +122,7 @@ def test_struct_typedef_1():
|
||||
)
|
||||
|
||||
|
||||
def test_struct_typedef_2():
|
||||
def test_struct_typedef_2() -> None:
|
||||
content = """
|
||||
typedef struct {
|
||||
int m;
|
||||
@ -176,7 +176,7 @@ def test_struct_typedef_2():
|
||||
)
|
||||
|
||||
|
||||
def test_typedef_array():
|
||||
def test_typedef_array() -> None:
|
||||
content = """
|
||||
typedef char TenCharArray[10];
|
||||
"""
|
||||
@ -201,7 +201,7 @@ def test_typedef_array():
|
||||
)
|
||||
|
||||
|
||||
def test_typedef_array_of_struct():
|
||||
def test_typedef_array_of_struct() -> None:
|
||||
content = """
|
||||
typedef struct{} tx[3], ty;
|
||||
"""
|
||||
@ -243,7 +243,7 @@ def test_typedef_array_of_struct():
|
||||
)
|
||||
|
||||
|
||||
def test_typedef_class_w_base():
|
||||
def test_typedef_class_w_base() -> None:
|
||||
content = """
|
||||
typedef class XX : public F {} G;
|
||||
"""
|
||||
@ -280,7 +280,7 @@ def test_typedef_class_w_base():
|
||||
)
|
||||
|
||||
|
||||
def test_complicated_typedef():
|
||||
def test_complicated_typedef() -> None:
|
||||
content = """
|
||||
typedef int int_t, *intp_t, (&fp)(int, ulong), arr_t[10];
|
||||
"""
|
||||
@ -345,7 +345,7 @@ def test_complicated_typedef():
|
||||
)
|
||||
|
||||
|
||||
def test_typedef_c_struct_idiom():
|
||||
def test_typedef_c_struct_idiom() -> None:
|
||||
content = """
|
||||
// common C idiom to avoid having to write "struct S"
|
||||
typedef struct {int a; int b;} S, *pS;
|
||||
@ -407,7 +407,7 @@ def test_typedef_c_struct_idiom():
|
||||
)
|
||||
|
||||
|
||||
def test_typedef_struct_same_name():
|
||||
def test_typedef_struct_same_name() -> None:
|
||||
content = """
|
||||
typedef struct Fig {
|
||||
int a;
|
||||
@ -451,7 +451,7 @@ def test_typedef_struct_same_name():
|
||||
)
|
||||
|
||||
|
||||
def test_typedef_struct_w_enum():
|
||||
def test_typedef_struct_w_enum() -> None:
|
||||
content = """
|
||||
typedef struct {
|
||||
enum BeetEnum : int { FAIL = 0, PASS = 1 };
|
||||
@ -502,7 +502,7 @@ def test_typedef_struct_w_enum():
|
||||
)
|
||||
|
||||
|
||||
def test_typedef_union():
|
||||
def test_typedef_union() -> None:
|
||||
content = """
|
||||
typedef union apricot_t {
|
||||
int i;
|
||||
@ -569,7 +569,7 @@ def test_typedef_union():
|
||||
)
|
||||
|
||||
|
||||
def test_typedef_fnptr():
|
||||
def test_typedef_fnptr() -> None:
|
||||
content = """
|
||||
typedef void *(*fndef)(int);
|
||||
"""
|
||||
@ -606,7 +606,7 @@ def test_typedef_fnptr():
|
||||
)
|
||||
|
||||
|
||||
def test_typedef_const():
|
||||
def test_typedef_const() -> None:
|
||||
content = """
|
||||
typedef int theint, *const ptheint;
|
||||
"""
|
||||
@ -635,7 +635,7 @@ def test_typedef_const():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_typedef_1():
|
||||
def test_enum_typedef_1() -> None:
|
||||
content = """
|
||||
typedef enum {} E;
|
||||
"""
|
||||
@ -661,7 +661,7 @@ def test_enum_typedef_1():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_typedef_2():
|
||||
def test_enum_typedef_2() -> None:
|
||||
content = """
|
||||
typedef enum { E1 } BE;
|
||||
"""
|
||||
@ -687,7 +687,7 @@ def test_enum_typedef_2():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_typedef_3():
|
||||
def test_enum_typedef_3() -> None:
|
||||
content = """
|
||||
typedef enum { E1, E2, } E;
|
||||
"""
|
||||
@ -713,7 +713,7 @@ def test_enum_typedef_3():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_typedef_3_1():
|
||||
def test_enum_typedef_3_1() -> None:
|
||||
content = """
|
||||
typedef enum { E1 } * PBE;
|
||||
"""
|
||||
@ -743,7 +743,7 @@ def test_enum_typedef_3_1():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_typedef_4():
|
||||
def test_enum_typedef_4() -> None:
|
||||
content = """
|
||||
typedef enum { E1 } * PBE, BE;
|
||||
"""
|
||||
@ -779,7 +779,7 @@ def test_enum_typedef_4():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_typedef_5():
|
||||
def test_enum_typedef_5() -> None:
|
||||
content = """
|
||||
typedef enum { E1 } BE, *PBE;
|
||||
"""
|
||||
@ -815,7 +815,7 @@ def test_enum_typedef_5():
|
||||
)
|
||||
|
||||
|
||||
def test_enum_typedef_fwd():
|
||||
def test_enum_typedef_fwd() -> None:
|
||||
content = """
|
||||
typedef enum BE BET;
|
||||
"""
|
||||
@ -837,7 +837,7 @@ def test_enum_typedef_fwd():
|
||||
)
|
||||
|
||||
|
||||
def test_typedef_enum_expr():
|
||||
def test_typedef_enum_expr() -> None:
|
||||
content = """
|
||||
typedef enum { StarFruit = (2 + 2) / 2 } Carambola;
|
||||
"""
|
||||
@ -878,7 +878,7 @@ def test_typedef_enum_expr():
|
||||
)
|
||||
|
||||
|
||||
def test_volatile_typedef():
|
||||
def test_volatile_typedef() -> None:
|
||||
content = """
|
||||
typedef volatile signed short vint16;
|
||||
"""
|
||||
@ -901,7 +901,7 @@ def test_volatile_typedef():
|
||||
)
|
||||
|
||||
|
||||
def test_function_typedef():
|
||||
def test_function_typedef() -> None:
|
||||
content = """
|
||||
typedef void fn(int);
|
||||
typedef auto fntype(int) -> int;
|
||||
|
@ -17,7 +17,7 @@ from cxxheaderparser.simple import (
|
||||
)
|
||||
|
||||
|
||||
def test_union_basic():
|
||||
def test_union_basic() -> None:
|
||||
content = """
|
||||
|
||||
struct HAL_Value {
|
||||
@ -86,7 +86,7 @@ def test_union_basic():
|
||||
)
|
||||
|
||||
|
||||
def test_union_anon_in_struct():
|
||||
def test_union_anon_in_struct() -> None:
|
||||
content = """
|
||||
struct Outer {
|
||||
union {
|
||||
|
@ -30,7 +30,7 @@ from cxxheaderparser.simple import (
|
||||
)
|
||||
|
||||
|
||||
def test_using_namespace():
|
||||
def test_using_namespace() -> None:
|
||||
content = """
|
||||
using namespace foo;
|
||||
using namespace foo::bar;
|
||||
@ -52,7 +52,7 @@ def test_using_namespace():
|
||||
)
|
||||
|
||||
|
||||
def test_using_declaration():
|
||||
def test_using_declaration() -> None:
|
||||
content = """
|
||||
using ::foo;
|
||||
using foo::bar;
|
||||
@ -104,7 +104,7 @@ def test_using_declaration():
|
||||
|
||||
|
||||
# alias-declaration
|
||||
def test_alias_declaration_1():
|
||||
def test_alias_declaration_1() -> None:
|
||||
content = """
|
||||
using alias = foo;
|
||||
"""
|
||||
@ -122,7 +122,7 @@ def test_alias_declaration_1():
|
||||
)
|
||||
|
||||
|
||||
def test_alias_declaration_2():
|
||||
def test_alias_declaration_2() -> None:
|
||||
content = """
|
||||
template <typename T> using alias = foo<T>;
|
||||
"""
|
||||
@ -164,7 +164,7 @@ def test_alias_declaration_2():
|
||||
)
|
||||
|
||||
|
||||
def test_alias_declaration_3():
|
||||
def test_alias_declaration_3() -> None:
|
||||
content = """
|
||||
using alias = ::foo::bar;
|
||||
"""
|
||||
@ -190,7 +190,7 @@ def test_alias_declaration_3():
|
||||
)
|
||||
|
||||
|
||||
def test_alias_declaration_4():
|
||||
def test_alias_declaration_4() -> None:
|
||||
content = """
|
||||
template <typename T> using alias = ::foo::bar<T>;
|
||||
"""
|
||||
@ -234,7 +234,7 @@ def test_alias_declaration_4():
|
||||
)
|
||||
|
||||
|
||||
def test_alias_declaration_5():
|
||||
def test_alias_declaration_5() -> None:
|
||||
content = """
|
||||
using alias = foo::bar;
|
||||
"""
|
||||
@ -259,7 +259,7 @@ def test_alias_declaration_5():
|
||||
)
|
||||
|
||||
|
||||
def test_alias_declaration_6():
|
||||
def test_alias_declaration_6() -> None:
|
||||
content = """
|
||||
template <typename T> using alias = foo<T>::bar;
|
||||
"""
|
||||
@ -302,7 +302,7 @@ def test_alias_declaration_6():
|
||||
)
|
||||
|
||||
|
||||
def test_using_many_things():
|
||||
def test_using_many_things() -> None:
|
||||
content = """
|
||||
// clang-format off
|
||||
|
||||
|
@ -22,7 +22,7 @@ from cxxheaderparser.types import (
|
||||
from cxxheaderparser.simple import ClassScope, NamespaceScope, ParsedData, parse_string
|
||||
|
||||
|
||||
def test_var_unixwiz_ridiculous():
|
||||
def test_var_unixwiz_ridiculous() -> None:
|
||||
# http://unixwiz.net/techtips/reading-cdecl.html
|
||||
#
|
||||
# .. "we have no idea how this variable is useful, but at least we can
|
||||
@ -73,7 +73,7 @@ def test_var_unixwiz_ridiculous():
|
||||
)
|
||||
|
||||
|
||||
def test_var_ptr_to_array15_of_ptr_to_int():
|
||||
def test_var_ptr_to_array15_of_ptr_to_int() -> None:
|
||||
content = """
|
||||
int *(*crocodile)[15];
|
||||
"""
|
||||
@ -102,7 +102,7 @@ def test_var_ptr_to_array15_of_ptr_to_int():
|
||||
)
|
||||
|
||||
|
||||
def test_var_ref_to_array():
|
||||
def test_var_ref_to_array() -> None:
|
||||
content = """
|
||||
int abase[3];
|
||||
int (&aname)[3] = abase;
|
||||
@ -140,7 +140,7 @@ def test_var_ref_to_array():
|
||||
)
|
||||
|
||||
|
||||
def test_var_ptr_to_array():
|
||||
def test_var_ptr_to_array() -> None:
|
||||
content = """
|
||||
int zz, (*aname)[3] = &abase;
|
||||
"""
|
||||
@ -174,7 +174,7 @@ def test_var_ptr_to_array():
|
||||
)
|
||||
|
||||
|
||||
def test_var_multi_1():
|
||||
def test_var_multi_1() -> None:
|
||||
content = """
|
||||
int zz, (&aname)[3] = abase;
|
||||
"""
|
||||
@ -208,7 +208,7 @@ def test_var_multi_1():
|
||||
)
|
||||
|
||||
|
||||
def test_var_array_of_fnptr_varargs():
|
||||
def test_var_array_of_fnptr_varargs() -> None:
|
||||
content = """
|
||||
void (*a3[3])(int, ...);
|
||||
"""
|
||||
@ -249,7 +249,7 @@ def test_var_array_of_fnptr_varargs():
|
||||
)
|
||||
|
||||
|
||||
def test_var_double_fnptr_varargs():
|
||||
def test_var_double_fnptr_varargs() -> None:
|
||||
content = """
|
||||
void (*(*a4))(int, ...);
|
||||
"""
|
||||
@ -289,7 +289,7 @@ def test_var_double_fnptr_varargs():
|
||||
)
|
||||
|
||||
|
||||
def test_var_fnptr_voidstar():
|
||||
def test_var_fnptr_voidstar() -> None:
|
||||
content = """
|
||||
void(*(*a5)(int));
|
||||
"""
|
||||
@ -326,7 +326,7 @@ def test_var_fnptr_voidstar():
|
||||
)
|
||||
|
||||
|
||||
def test_var_fnptr_moreparens():
|
||||
def test_var_fnptr_moreparens() -> None:
|
||||
content = """
|
||||
void (*x)(int(p1), int);
|
||||
"""
|
||||
@ -384,7 +384,7 @@ def test_var_fnptr_moreparens():
|
||||
# Means "const pointer to pointer to char"
|
||||
|
||||
|
||||
def test_var_ptr_to_const_ptr_to_char():
|
||||
def test_var_ptr_to_const_ptr_to_char() -> None:
|
||||
content = """
|
||||
char *const *p;
|
||||
"""
|
||||
@ -411,7 +411,7 @@ def test_var_ptr_to_const_ptr_to_char():
|
||||
)
|
||||
|
||||
|
||||
def test_var_const_ptr_to_ptr_to_char():
|
||||
def test_var_const_ptr_to_ptr_to_char() -> None:
|
||||
content = """
|
||||
char **const p;
|
||||
"""
|
||||
@ -438,7 +438,7 @@ def test_var_const_ptr_to_ptr_to_char():
|
||||
)
|
||||
|
||||
|
||||
def test_var_array_initializer1():
|
||||
def test_var_array_initializer1() -> None:
|
||||
content = """
|
||||
int x[3]{1, 2, 3};
|
||||
"""
|
||||
@ -472,7 +472,7 @@ def test_var_array_initializer1():
|
||||
)
|
||||
|
||||
|
||||
def test_var_array_initializer2():
|
||||
def test_var_array_initializer2() -> None:
|
||||
content = """
|
||||
int x[3] = {1, 2, 3};
|
||||
"""
|
||||
@ -506,7 +506,7 @@ def test_var_array_initializer2():
|
||||
)
|
||||
|
||||
|
||||
def test_var_extern_c():
|
||||
def test_var_extern_c() -> None:
|
||||
content = """
|
||||
extern "C" int x;
|
||||
"""
|
||||
@ -528,7 +528,7 @@ def test_var_extern_c():
|
||||
)
|
||||
|
||||
|
||||
def test_var_ns_1():
|
||||
def test_var_ns_1() -> None:
|
||||
content = """
|
||||
int N::x;
|
||||
"""
|
||||
@ -550,7 +550,7 @@ def test_var_ns_1():
|
||||
)
|
||||
|
||||
|
||||
def test_var_ns_2():
|
||||
def test_var_ns_2() -> None:
|
||||
content = """
|
||||
int N::x = 4;
|
||||
"""
|
||||
@ -573,7 +573,7 @@ def test_var_ns_2():
|
||||
)
|
||||
|
||||
|
||||
def test_var_ns_3():
|
||||
def test_var_ns_3() -> None:
|
||||
content = """
|
||||
int N::x{4};
|
||||
"""
|
||||
@ -598,7 +598,7 @@ def test_var_ns_3():
|
||||
)
|
||||
|
||||
|
||||
def test_var_static_struct():
|
||||
def test_var_static_struct() -> None:
|
||||
content = """
|
||||
constexpr static struct SS {} s;
|
||||
"""
|
||||
@ -631,7 +631,7 @@ def test_var_static_struct():
|
||||
)
|
||||
|
||||
|
||||
def test_var_constexpr_enum():
|
||||
def test_var_constexpr_enum() -> None:
|
||||
content = """
|
||||
constexpr enum E { EE } e = EE;
|
||||
"""
|
||||
@ -663,7 +663,7 @@ def test_var_constexpr_enum():
|
||||
)
|
||||
|
||||
|
||||
def test_var_fnptr_in_class():
|
||||
def test_var_fnptr_in_class() -> None:
|
||||
content = """
|
||||
struct DriverFuncs {
|
||||
void *(*init)();
|
||||
@ -747,7 +747,7 @@ def test_var_fnptr_in_class():
|
||||
)
|
||||
|
||||
|
||||
def test_var_extern():
|
||||
def test_var_extern() -> None:
|
||||
content = """
|
||||
extern int externVar;
|
||||
"""
|
||||
|
Loading…
x
Reference in New Issue
Block a user