3
3
// BSD-style license that can be found in the LICENSE file.
4
4
5
5
import 'package:ffigen/src/code_generator.dart' ;
6
+ import 'package:ffigen/src/config_provider/config.dart' ;
7
+ import 'package:ffigen/src/header_parser/parser.dart' ;
6
8
import 'package:logging/logging.dart' ;
7
9
import 'package:test/test.dart' ;
8
10
import '../test_utils.dart' ;
@@ -13,50 +15,65 @@ void main() {
13
15
logWarnings (Level .SEVERE );
14
16
});
15
17
test ('declaration conflict' , () {
16
- final library = Library (name: 'Bindings' , bindings: [
17
- Struct (name: 'TestStruct' ),
18
- Struct (name: 'TestStruct' ),
19
- EnumClass (name: 'TestEnum' ),
20
- EnumClass (name: 'TestEnum' ),
21
- Func (
22
- name: 'testFunc' ,
23
- returnType: NativeType (SupportedNativeType .voidType)),
24
- Func (
25
- name: 'testFunc' ,
26
- returnType: NativeType (SupportedNativeType .voidType)),
27
- Constant (
28
- originalName: 'Test_Macro' ,
29
- name: 'Test_Macro' ,
30
- rawType: 'int' ,
31
- rawValue: '0' ,
32
- ),
33
- Constant (
34
- originalName: 'Test_Macro' ,
35
- name: 'Test_Macro' ,
36
- rawType: 'int' ,
37
- rawValue: '0' ,
38
- ),
39
- Typealias (
40
- name: 'testAlias' , type: NativeType (SupportedNativeType .voidType)),
41
- Typealias (
42
- name: 'testAlias' , type: NativeType (SupportedNativeType .voidType)),
18
+ final config = Config (
19
+ entryPoints: [],
20
+ output: Uri (),
21
+ functionDecl: DeclarationFilters .includeAll,
22
+ structDecl: DeclarationFilters .includeAll,
23
+ enumClassDecl: DeclarationFilters .includeAll,
24
+ globals: DeclarationFilters .includeAll,
25
+ macroDecl: DeclarationFilters .includeAll,
26
+ typedefs: DeclarationFilters .includeAll,
27
+ );
28
+ final library = Library (
29
+ name: 'Bindings' ,
30
+ bindings: transformBindings (config, [
31
+ Struct (name: 'TestStruct' ),
32
+ Struct (name: 'TestStruct' ),
33
+ EnumClass (name: 'TestEnum' ),
34
+ EnumClass (name: 'TestEnum' ),
35
+ Func (
36
+ name: 'testFunc' ,
37
+ returnType: NativeType (SupportedNativeType .voidType)),
38
+ Func (
39
+ name: 'testFunc' ,
40
+ returnType: NativeType (SupportedNativeType .voidType)),
41
+ MacroConstant (
42
+ originalName: 'Test_Macro' ,
43
+ name: 'Test_Macro' ,
44
+ rawType: 'int' ,
45
+ rawValue: '0' ,
46
+ ),
47
+ MacroConstant (
48
+ originalName: 'Test_Macro' ,
49
+ name: 'Test_Macro' ,
50
+ rawType: 'int' ,
51
+ rawValue: '0' ,
52
+ ),
53
+ Typealias (
54
+ name: 'testAlias' ,
55
+ type: NativeType (SupportedNativeType .voidType)),
56
+ Typealias (
57
+ name: 'testAlias' ,
58
+ type: NativeType (SupportedNativeType .voidType)),
43
59
44
- /// Conflicts across declarations.
45
- Struct (name: 'testCrossDecl' ),
46
- Func (
47
- name: 'testCrossDecl' ,
48
- returnType: NativeType (SupportedNativeType .voidType)),
49
- Constant (name: 'testCrossDecl' , rawValue: '0' , rawType: 'int' ),
50
- EnumClass (name: 'testCrossDecl' ),
51
- Typealias (
52
- name: 'testCrossDecl' ,
53
- type: NativeType (SupportedNativeType .voidType)),
60
+ /// Conflicts across declarations.
61
+ Struct (name: 'testCrossDecl' ),
62
+ Func (
63
+ name: 'testCrossDecl' ,
64
+ returnType: NativeType (SupportedNativeType .voidType)),
65
+ MacroConstant (name: 'testCrossDecl' , rawValue: '0' , rawType: 'int' ),
66
+ EnumClass (name: 'testCrossDecl' ),
67
+ Typealias (
68
+ name: 'testCrossDecl' ,
69
+ type: NativeType (SupportedNativeType .voidType)),
54
70
55
- /// Conflicts with ffi library prefix, name of prefix is changed.
56
- Struct (name: 'ffi' ),
57
- Func (
58
- name: 'ffi1' , returnType: NativeType (SupportedNativeType .voidType)),
59
- ]);
71
+ /// Conflicts with ffi library prefix, name of prefix is changed.
72
+ Struct (name: 'ffi' ),
73
+ Func (
74
+ name: 'ffi1' ,
75
+ returnType: NativeType (SupportedNativeType .voidType)),
76
+ ]));
60
77
matchLibraryWithExpected (
61
78
library, 'decl_decl_collision_test_output.dart' , [
62
79
'test' ,
0 commit comments