Skip to content

Commit

Permalink
add license headers to code generator test goldens
Browse files Browse the repository at this point in the history
  • Loading branch information
miDeb committed Dec 14, 2023
1 parent e1a8c0c commit 94b4ff4
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 4 deletions.
23 changes: 19 additions & 4 deletions pkgs/ffigen/test/code_generator_tests/code_generator_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,17 @@ import 'package:test/test.dart';
import '../test_utils.dart';

void main() {
const licenseHeader = '''
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
''';

group('code_generator: ', () {
void functionBindings(bool enableFfiNative) {
final library = Library(
name: 'Bindings',
header: licenseHeader,
bindings: [
Func(
ffiNativeConfig: FfiNativeConfig(enabled: enableFfiNative),
Expand Down Expand Up @@ -105,6 +112,7 @@ void main() {
test('Struct Binding (primitives, pointers)', () {
final library = Library(
name: 'Bindings',
header: licenseHeader,
bindings: [
Struct(
name: 'NoMember',
Expand Down Expand Up @@ -217,6 +225,7 @@ void main() {
);
final library = Library(
name: 'Bindings',
header: licenseHeader,
bindings: [
structSome,
Func(
Expand Down Expand Up @@ -249,6 +258,7 @@ void main() {

final library = Library(
name: 'Bindings',
header: licenseHeader,
bindings: [
Global(
name: 'test1',
Expand Down Expand Up @@ -282,7 +292,7 @@ void main() {
test('constant', () {
final library = Library(
name: 'Bindings',
header: '// ignore_for_file: unused_import\n',
header: '$licenseHeader\n// ignore_for_file: unused_import\n',
bindings: [
Constant(
name: 'test1',
Expand All @@ -302,7 +312,7 @@ void main() {
test('enum_class', () {
final library = Library(
name: 'Bindings',
header: '// ignore_for_file: unused_import\n',
header: '$licenseHeader\n// ignore_for_file: unused_import\n',
bindings: [
EnumClass(
name: 'Constants',
Expand All @@ -323,7 +333,7 @@ void main() {
final library = Library(
name: 'init_dylib',
header:
'// ignore_for_file: unused_element, camel_case_types, non_constant_identifier_names\n',
'$licenseHeader\n// ignore_for_file: unused_element, camel_case_types, non_constant_identifier_names\n',
bindings: [
Func(
name: 'test',
Expand Down Expand Up @@ -370,6 +380,7 @@ void main() {
test('boolean_dartBool', () {
final library = Library(
name: 'Bindings',
header: licenseHeader,
bindings: [
Func(
name: 'test1',
Expand All @@ -392,6 +403,7 @@ void main() {
test('sort bindings', () {
final library = Library(
name: 'Bindings',
header: licenseHeader,
sort: true,
bindings: [
Func(name: 'b', returnType: NativeType(SupportedNativeType.Void)),
Expand All @@ -405,6 +417,7 @@ void main() {
test('Pack Structs', () {
final library = Library(
name: 'Bindings',
header: licenseHeader,
bindings: [
Struct(name: 'NoPacking', pack: null, members: [
Member(name: 'a', type: NativeType(SupportedNativeType.Char)),
Expand Down Expand Up @@ -435,6 +448,7 @@ void main() {
Union(name: 'Union1', members: [Member(name: 'a', type: charType)]);
final library = Library(
name: 'Bindings',
header: licenseHeader,
bindings: [
struct1,
union1,
Expand Down Expand Up @@ -465,7 +479,8 @@ void main() {
test('Typealias Bindings', () {
final library = Library(
name: 'Bindings',
header: '// ignore_for_file: non_constant_identifier_names\n',
header:
'$licenseHeader\n// ignore_for_file: non_constant_identifier_names\n',
bindings: [
Typealias(name: 'RawUnused', type: Struct(name: 'Struct1')),
Struct(name: 'WithTypealiasStruct', members: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// ignore_for_file: unused_import

// AUTO GENERATED FILE, DO NOT EDIT.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// ignore_for_file: unused_import

// AUTO GENERATED FILE, DO NOT EDIT.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// ignore_for_file: unused_element, camel_case_types, non_constant_identifier_names

// AUTO GENERATED FILE, DO NOT EDIT.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// ignore_for_file: non_constant_identifier_names

// AUTO GENERATED FILE, DO NOT EDIT.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
Expand Down

0 comments on commit 94b4ff4

Please sign in to comment.