Chromium Code Reviews| Index: test/mixin_test.dart |
| diff --git a/test/mixin_test.dart b/test/mixin_test.dart |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..d3ef19e0ec2fd12b77c134e542d7638059766345 |
| --- /dev/null |
| +++ b/test/mixin_test.dart |
| @@ -0,0 +1,65 @@ |
| +import 'package:test/test.dart'; |
| + |
| +import '../out/protos/mixins.pb.dart' as pb; |
| +import 'package:protoc_plugin/testing/mixins.dart'; |
| + |
| +void main() { |
| + group('Proto with Mixin1', () { |
| + pb.Mixin1PB proto; |
| + |
| + setUp(() { |
| + proto = new pb.Mixin1PB(); |
| + }); |
| + |
| + test('is a Mixin1', () { |
| + expect(proto is Mixin1, isTrue); |
| + expect(proto is Mixin2, isFalse); |
| + }); |
| + |
| + test('implements interface defined by mixins', () { |
| + proto.interfaceString = 'test'; |
| + expect(proto.hasInterfaceString(), isTrue); |
| + expect(proto.interfaceString, equals('test')); |
| + }); |
| + |
| + test('overrides field with annotation', () { |
|
skybrian
2016/06/22 20:29:53
It's unclear what we're testing here. It seems lik
frederikmutzel
2016/06/23 12:30:16
Removed.
|
| + expect(proto.overriddenString, isEmpty); |
| + expect(proto.hasOverriddenString(), isFalse); |
| + |
| + proto.overriddenString = 'test'; |
| + expect(proto.overriddenString, equals('test')); |
| + expect(proto.hasOverriddenString(), isTrue); |
| + |
| + proto.clearOverriddenString(); |
| + expect(proto.hasOverriddenString(), isFalse); |
| + }); |
| + }); |
| + |
| + group('Proto with Mixin2', () { |
| + pb.Mixin2PB proto; |
| + |
| + setUp(() { |
| + proto = new pb.Mixin2PB(); |
| + }); |
| + |
| + test('overrides has method', () { |
| + expect(proto.hasOverriddenHasMethod(), isFalse); |
| + proto.overriddenHasMethod = 'test'; |
| + |
| + expect(proto.hasOverriddenHasMethod(), isTrue); |
| + }); |
| + }); |
| + |
| + group('Proto without mixins', () { |
| + pb.NoMixinPB proto; |
| + |
| + setUp(() { |
| + proto = new pb.NoMixinPB(); |
| + }); |
| + |
| + test('is neither Mixin1 nor Mixin2', () { |
| + expect(proto is Mixin1, isFalse); |
| + expect(proto is Mixin2, isFalse); |
| + }); |
| + }); |
| +} |