1/* Copyright 2017 The Bazel Authors. All rights reserved. 2 3Licensed under the Apache License, Version 2.0 (the "License"); 4you may not use this file except in compliance with the License. 5You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9Unless required by applicable law or agreed to in writing, software 10distributed under the License is distributed on an "AS IS" BASIS, 11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12See the License for the specific language governing permissions and 13limitations under the License. 14*/ 15 16package proto 17 18import ( 19 "testing" 20 21 embed "github.com/bazelbuild/rules_go/examples/proto/embed" 22 lib_proto "github.com/bazelbuild/rules_go/examples/proto/lib/lib_proto" 23) 24 25func TestProto(t *testing.T) { 26 p := lib_proto.LibObject{AreYouSure: 20} 27 sure := p.GetAreYouSure() 28 if sure != 20 { 29 t.Errorf("got %d, want 20", sure) 30 } 31} 32 33func TestEmbed(t *testing.T) { 34 if embed.OtherThing().A != 42 { 35 t.Errorf("Unable to call method from embedded go files") 36 } 37} 38 39func TestValidate(t *testing.T) { 40 if err := embed.OtherThing().Validate(); err != nil { 41 t.Errorf("Proto did not pass validation") 42 } 43} 44