From 6d735e4d0d9d8fc6bd8033e3d151e4b7ca24c45c Mon Sep 17 00:00:00 2001 From: Nick Fisher Date: Wed, 1 Nov 2023 15:55:29 +0800 Subject: [PATCH] remove native_test codegen test for assetId --- ...ed_native_test_bindings_with_asset_id.dart | 138 ------------------ test/native_test/config_with_asset_id.yaml | 23 --- test/native_test/native_test.dart | 32 ---- 3 files changed, 193 deletions(-) delete mode 100644 test/native_test/_expected_native_test_bindings_with_asset_id.dart delete mode 100644 test/native_test/config_with_asset_id.yaml diff --git a/test/native_test/_expected_native_test_bindings_with_asset_id.dart b/test/native_test/_expected_native_test_bindings_with_asset_id.dart deleted file mode 100644 index 8bdd482e..00000000 --- a/test/native_test/_expected_native_test_bindings_with_asset_id.dart +++ /dev/null @@ -1,138 +0,0 @@ -// ignore_for_file: camel_case_types, non_constant_identifier_names - -// AUTO GENERATED FILE, DO NOT EDIT. -// -// Generated by `package:ffigen`. -// ignore_for_file: type=lint -import 'dart:ffi' as ffi; - -@ffi.Native( - symbol: 'Function1Bool', - assetId: 'package:ffinative_example/generated_bindings.dart') -external bool Function1Bool( - bool x, -); - -@ffi.Native( - symbol: 'Function1Uint8', - assetId: 'package:ffinative_example/generated_bindings.dart') -external int Function1Uint8( - int x, -); - -@ffi.Native( - symbol: 'Function1Uint16', - assetId: 'package:ffinative_example/generated_bindings.dart') -external int Function1Uint16( - int x, -); - -@ffi.Native( - symbol: 'Function1Uint32', - assetId: 'package:ffinative_example/generated_bindings.dart') -external int Function1Uint32( - int x, -); - -@ffi.Native( - symbol: 'Function1Uint64', - assetId: 'package:ffinative_example/generated_bindings.dart') -external int Function1Uint64( - int x, -); - -@ffi.Native( - symbol: 'Function1Int8', - assetId: 'package:ffinative_example/generated_bindings.dart') -external int Function1Int8( - int x, -); - -@ffi.Native( - symbol: 'Function1Int16', - assetId: 'package:ffinative_example/generated_bindings.dart') -external int Function1Int16( - int x, -); - -@ffi.Native( - symbol: 'Function1Int32', - assetId: 'package:ffinative_example/generated_bindings.dart') -external int Function1Int32( - int x, -); - -@ffi.Native( - symbol: 'Function1Int64', - assetId: 'package:ffinative_example/generated_bindings.dart') -external int Function1Int64( - int x, -); - -@ffi.Native( - symbol: 'Function1IntPtr', - assetId: 'package:ffinative_example/generated_bindings.dart') -external int Function1IntPtr( - int x, -); - -@ffi.Native( - symbol: 'Function1UintPtr', - assetId: 'package:ffinative_example/generated_bindings.dart') -external int Function1UintPtr( - int x, -); - -@ffi.Native( - symbol: 'Function1Float', - assetId: 'package:ffinative_example/generated_bindings.dart') -external double Function1Float( - double x, -); - -@ffi.Native( - symbol: 'Function1Double', - assetId: 'package:ffinative_example/generated_bindings.dart') -external double Function1Double( - double x, -); - -@ffi.Native Function()>( - symbol: 'getStruct1', - assetId: 'package:ffinative_example/generated_bindings.dart') -external ffi.Pointer getStruct1(); - -@ffi.Native( - symbol: 'Function1StructReturnByValue', - assetId: 'package:ffinative_example/generated_bindings.dart') -external Struct3 Function1StructReturnByValue( - int a, - int b, - int c, -); - -@ffi.Native( - symbol: 'Function1StructPassByValue', - assetId: 'package:ffinative_example/generated_bindings.dart') -external int Function1StructPassByValue( - Struct3 sum_a_b_c, -); - -final class Struct1 extends ffi.Struct { - @ffi.Int8() - external int a; - - @ffi.Array.multi([3, 1, 2]) - external ffi.Array>> data; -} - -final class Struct3 extends ffi.Struct { - @ffi.Int() - external int a; - - @ffi.Int() - external int b; - - @ffi.Int() - external int c; -} diff --git a/test/native_test/config_with_asset_id.yaml b/test/native_test/config_with_asset_id.yaml deleted file mode 100644 index 658210f0..00000000 --- a/test/native_test/config_with_asset_id.yaml +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright (c) 2020, 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. - -# =================== GENERATING TEST BINDINGS ================== -# dart run ffigen --config test/native_test/config.yaml -# =============================================================== - -name: NativeLibrary -description: 'Native tests.' -output: '_expected_native_test_bindings_with_asset_id.dart' -headers: - entry-points: - - 'native_test.c' - include-directives: - - '**native_test.c' -ffi-native: - assetId: 'package:ffinative_example/generated_bindings.dart' # (optional) - -compiler-opts: '-Wno-nullability-completeness' -preamble: | - // ignore_for_file: camel_case_types, non_constant_identifier_names - diff --git a/test/native_test/native_test.dart b/test/native_test/native_test.dart index 134290f8..9c734a56 100644 --- a/test/native_test/native_test.dart +++ b/test/native_test/native_test.dart @@ -59,38 +59,6 @@ void main() { } }); - test('generate_bindings with assetId', () { - final configFile = - File(path.join('test', 'native_test', 'config_with_asset_id.yaml')) - .absolute; - final outFile = File( - path.join('test', 'debug_generated', - '_expected_native_test_bindings_with_asset_id.dart'), - ).absolute; - - late Config config; - withChDir(configFile.path, () { - config = testConfigFromPath(configFile.path); - }); - final library = parse(config); - - library.generateFile(outFile); - - try { - final actual = outFile.readAsStringSync().replaceAll('\r', ''); - final expected = File(path.join(config.output)) - .readAsStringSync() - .replaceAll('\r', ''); - expect(actual, expected); - if (outFile.existsSync()) { - outFile.delete(); - } - } catch (e) { - print('Failed test: Debug generated file: ${outFile.absolute.path}'); - rethrow; - } - }); - test('bool', () { expect(bindings.Function1Bool(true), false); expect(bindings.Function1Bool(false), true);