From 99002ae47a3f88f64ff44dbd80452360e0e5fbc4 Mon Sep 17 00:00:00 2001 From: Bo Yang Date: Tue, 23 Jan 2018 15:46:06 -0800 Subject: Initialize python-wheel branch --- examples/add_person_test.go | 58 --------------------------------------------- 1 file changed, 58 deletions(-) delete mode 100644 examples/add_person_test.go (limited to 'examples/add_person_test.go') diff --git a/examples/add_person_test.go b/examples/add_person_test.go deleted file mode 100644 index 0507db6f..00000000 --- a/examples/add_person_test.go +++ /dev/null @@ -1,58 +0,0 @@ -package main - -import ( - "strings" - "testing" - - "github.com/golang/protobuf/proto" - pb "github.com/google/protobuf/examples/tutorial" -) - -func TestPromptForAddressReturnsAddress(t *testing.T) { - in := `12345 -Example Name -name@example.com -123-456-7890 -home -222-222-2222 -mobile -111-111-1111 -work -777-777-7777 -unknown - -` - got, err := promptForAddress(strings.NewReader(in)) - if err != nil { - t.Fatalf("promptForAddress(%q) had unexpected error: %s", in, err.Error()) - } - if got.Id != 12345 { - t.Errorf("promptForAddress(%q) got %d, want ID %d", in, got.Id, 12345) - } - if got.Name != "Example Name" { - t.Errorf("promptForAddress(%q) => want name %q, got %q", "Example Name", got.Name) - } - if got.Email != "name@example.com" { - t.Errorf("promptForAddress(%q) => want email %q, got %q", "name@example.com", got.Email) - } - - want := []*pb.Person_PhoneNumber{ - {Number: "123-456-7890", Type: pb.Person_HOME}, - {Number: "222-222-2222", Type: pb.Person_MOBILE}, - {Number: "111-111-1111", Type: pb.Person_WORK}, - {Number: "777-777-7777", Type: pb.Person_MOBILE}, - } - if len(got.Phones) != len(want) { - t.Errorf("want %d phone numbers, got %d", len(want), len(got.Phones)) - } - phones := len(got.Phones) - if phones > len(want) { - phones = len(want) - } - for i := 0; i < phones; i++ { - if !proto.Equal(got.Phones[i], want[i]) { - t.Errorf("want phone %q, got %q", *want[i], *got.Phones[i]) - } - - } -} -- cgit v1.2.3