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

Unified 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, 6 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 side-by-side diff with in-line comments
Download patch
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);
+ });
+ });
+}

Powered by Google App Engine
This is Rietveld 408576698