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

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: Revert pubspec-yaml to require 0.5.2, forgot that in the last upload 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
26 group('Proto with Mixin2', () {
27 pb.Mixin2PB proto;
28
29 setUp(() {
30 proto = new pb.Mixin2PB();
31 });
32
33 test('overrides has method', () {
34 expect(proto.hasOverriddenHasMethod(), isFalse);
35 proto.overriddenHasMethod = 'test';
36
37 expect(proto.hasOverriddenHasMethod(), isTrue);
38 });
39 });
40
41 group('Proto without mixins', () {
42 pb.NoMixinPB proto;
43
44 setUp(() {
45 proto = new pb.NoMixinPB();
46 });
47
48 test('is neither Mixin1 nor Mixin2', () {
49 expect(proto is Mixin1, isFalse);
50 expect(proto is Mixin2, isFalse);
51 });
52 });
53
54 group('Proto with Mixin3', () {
55 pb.Mixin3PB proto;
56
57 setUp(() {
58 proto = new pb.Mixin3PB();
59 });
60
61 test('is both Mixin1 (from parent) and Mixin3', () {
62 expect(proto is Mixin1, isTrue);
63 expect(proto is Mixin2, isFalse);
64 expect(proto is Mixin3, isTrue);
65 });
66 });
67 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698