github.com/gernest/nezuko@v0.1.2/internal/web2/web_test.go (about) 1 // Copyright 2018 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package web2 6 7 import ( 8 "reflect" 9 "testing" 10 ) 11 12 var testNetrc = ` 13 machine api.github.com 14 login user 15 password pwd 16 17 machine incomlete.host 18 login justlogin 19 20 machine test.host 21 login user2 22 password pwd2 23 ` 24 25 func TestReadNetrc(t *testing.T) { 26 lines := parseNetrc(testNetrc) 27 want := []netrcLine{ 28 {"api.github.com", "user", "pwd"}, 29 {"test.host", "user2", "pwd2"}, 30 } 31 32 if !reflect.DeepEqual(lines, want) { 33 t.Errorf("parseNetrc:\nhave %q\nwant %q", lines, want) 34 } 35 }