blob: 822754257f15590b21194ad059958291d840d242 [file] [log] [blame]
#!/usr/bin/env dart
// Copyright (c) 2018, 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.
import 'package:test/test.dart';
import 'package:fixnum/fixnum.dart';
import '../out/protos/_leading_underscores.pb.dart';
void main() {
test('can set, read and clear all fields and refer to types', () {
A_ message = new A_();
message.setExtension(Leading_underscores_.p, Int64(99));
expect(message.getExtension(Leading_underscores_.p), Int64(99));
message.f = 'foo';
message.f_2 = 'foo2';
expect(message.f, 'foo');
expect(message.f_2, 'foo2');
expect(message.hasF(), false);
expect(message.hasF_2(), false);
expect(message.f, '');
expect(message.f_2, '');
A messageA = new A();
messageA.b = message;
messageA.b_6 = message;
expect(messageA.b_6, message);
messageA.amap['foo'] = message;
expect(messageA.amap['foo'], message);
messageA.e = Enum_.constant;
expect(messageA.e, Enum_.constant);
expect(messageA.e, Enum_.constant_);
expect(messageA.r, [message]);
messageA.setExtension(Leading_underscores_.q, Int64(100));
expect(messageA.getExtension(Leading_underscores_.q), Int64(100));
A__ a = A__() = 'hi';
expect(, 'hi');