Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: test/mixin_test.dart

Issue 2086253002: Allow application of external mixins to generated dart protos. (Closed) Base URL: https://github.com/dart-lang/dart-protoc-plugin.git@master
Patch Set: Add support for mixins in protos. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 import 'package:test/test.dart';
2
3 import '../out/protos/mixins.pb.dart' as pb;
4 import 'package:protoc_plugin/testing/mixins.dart';
5
6 void main() {
7 group('Proto with Mixin1', () {
8 pb.Mixin1PB proto;
9
10 setUp(() {
11 proto = new pb.Mixin1PB();
12 });
13
14 test('is a Mixin1', () {
15 expect(proto is Mixin1, isTrue);
16 expect(proto is Mixin2, isFalse);
17 });
18
19 test('implements interface defined by mixins', () {
20 proto.interfaceString = 'test';
21 expect(proto.hasInterfaceString(), isTrue);
22 expect(proto.interfaceString, equals('test'));
23 });
24
25 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.
26 expect(proto.overriddenString, isEmpty);
27 expect(proto.hasOverriddenString(), isFalse);
28
29 proto.overriddenString = 'test';
30 expect(proto.overriddenString, equals('test'));
31 expect(proto.hasOverriddenString(), isTrue);
32
33 proto.clearOverriddenString();
34 expect(proto.hasOverriddenString(), isFalse);
35 });
36 });
37
38 group('Proto with Mixin2', () {
39 pb.Mixin2PB proto;
40
41 setUp(() {
42 proto = new pb.Mixin2PB();
43 });
44
45 test('overrides has method', () {
46 expect(proto.hasOverriddenHasMethod(), isFalse);
47 proto.overriddenHasMethod = 'test';
48
49 expect(proto.hasOverriddenHasMethod(), isTrue);
50 });
51 });
52
53 group('Proto without mixins', () {
54 pb.NoMixinPB proto;
55
56 setUp(() {
57 proto = new pb.NoMixinPB();
58 });
59
60 test('is neither Mixin1 nor Mixin2', () {
61 expect(proto is Mixin1, isFalse);
62 expect(proto is Mixin2, isFalse);
63 });
64 });
65 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698