blob: 80cd96dc9084c654dc2b7f4f7ce5b206c7529684 [file] [log] [blame]
// 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.
import 'package:ffigen/src/header_parser.dart';
import 'package:logging/logging.dart';
import 'package:yaml/yaml.dart';
import 'package:ffigen/src/config_provider/config.dart';
import 'package:ffigen/src/strings.dart' as strings;
import 'package:test/test.dart';
import '../test_utils.dart';
void main() {
group('example_test', () {
setUpAll(() {
logWarnings(Level.SEVERE);
});
test('libclang-example', () {
final config = Config.fromYaml(loadYaml('''
${strings.output}: 'generated_bindings.dart'
${strings.sort}: true
${strings.headers}:
${strings.entryPoints}:
- third_party/libclang/include/clang-c/Index.h
${strings.includeDirectives}:
- '**CXString.h'
- '**Index.h'
${strings.compilerOpts}: '-I/usr/lib/llvm-9/include/ -I/usr/lib/llvm-10/include/ -IC:\Progra~1\LLVM\include -I/usr/local/opt/llvm/include/ -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ -Wno-nullability-completeness'
${strings.functions}:
${strings.include}:
- 'clang_.*'
${strings.structs}:
${strings.include}:
- 'CX.*'
${strings.enums}:
${strings.include}:
- 'CXTypeKind'
- 'CXGlobalOptFlags'
${strings.name}: 'LibClang'
${strings.description}: 'Holds bindings to LibClang.'
${strings.arrayWorkaround}: true
${strings.preamble}: |
/// AUTO GENERATED FILE, DO NOT EDIT.
///
/// Generated by `package:ffigen`.
${strings.comments}:
${strings.style}: ${strings.doxygen}
${strings.length}: ${strings.full}
''') as YamlMap);
final library = parse(config);
matchLibraryWithExpected(
library,
['test', 'debug_generated', 'libclang-example.dart'],
['example', 'libclang-example', config.output],
);
});
});
}