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

Side by Side Diff: common/config/projectName_test.go

Issue 2626433004: Move "common/config" common types into cfgtypes. (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
« no previous file with comments | « common/config/projectName.go ('k') | common/config/util.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 The LUCI Authors. All rights reserved.
2 // Use of this source code is governed under the Apache License, Version 2.0
3 // that can be found in the LICENSE file.
4
5 package config
6
7 import (
8 "fmt"
9 "testing"
10
11 . "github.com/luci/luci-go/common/testing/assertions"
12 . "github.com/smartystreets/goconvey/convey"
13 )
14
15 func TestProjectName(t *testing.T) {
16 t.Parallel()
17
18 Convey(`Testing valid project names`, t, func() {
19 for _, testCase := range []ProjectName{
20 "a",
21 "foo_bar-baz-059",
22 } {
23 Convey(fmt.Sprintf(`Project name %q is valid`, testCase) , func() {
24 So(testCase.Validate(), ShouldBeNil)
25 })
26 }
27 })
28
29 Convey(`Testing invalid project names`, t, func() {
30 for _, testCase := range []struct {
31 v ProjectName
32 errorsLike string
33 }{
34 {"", "cannot have empty name"},
35 {"foo/bar", "invalid character"},
36 {"_name", "must begin with a letter"},
37 {"1eet", "must begin with a letter"},
38 } {
39 Convey(fmt.Sprintf(`Project name %q fails with error %q` , testCase.v, testCase.errorsLike), func() {
40 So(testCase.v.Validate(), ShouldErrLike, testCas e.errorsLike)
41 })
42 }
43 })
44 }
OLDNEW
« no previous file with comments | « common/config/projectName.go ('k') | common/config/util.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698