| // Copyright (c) 2024, 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. | |
| // Objective C support is only available on mac. | |
| @TestOn('mac-os') | |
| import 'dart:ffi'; | |
| import 'dart:io'; | |
| import 'package:logging/logging.dart'; | |
| import 'package:path/path.dart' as path; | |
| import 'package:test/test.dart'; | |
| import '../test_utils.dart'; | |
| import 'log_config.dart' as log_config; | |
| import 'log_test_bindings.dart'; | |
| import 'util.dart'; | |
| void main() { | |
| group('log_test', () { | |
| test('Duplicate method log spam', () { | |
| final logs = <String>[]; | |
| final logger = createTestLogger( | |
| capturedMessages: logs, | |
| level: Level.SEVERE, | |
| ); | |
| final config = log_config.getConfig( | |
| Uri.file(path.join(packagePathForTests, '')), | |
| ); | |
| verifyBindings(config, logger: logger); | |
| expect(logs, isNot(contains(contains('matchingMethod')))); | |
| expect(logs, isNot(contains(contains('instancetypeMethod')))); | |
| }); | |
| test('Instancetype method overridden by id method', () { | |
| // Test that we keep the instancetype version of the method. Specifically, | |
| // LogSpamChildClass.instancetypeMethod returns LogSpamChildClass rather | |
| // than ObjCObject. | |
| final LogSpamChildClass obj = LogSpamChildClass.instancetypeMethod(); | |
| expect(LogSpamChildClass.isA(obj), isTrue); | |
| }); | |
| }); | |
| } |