| Index: swarming/tasktemplate/template_test.go
|
| diff --git a/swarming/tasktemplate/template_test.go b/swarming/tasktemplate/template_test.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..2bdcced98eec22d2d179e42c1b95d4e86bf84eec
|
| --- /dev/null
|
| +++ b/swarming/tasktemplate/template_test.go
|
| @@ -0,0 +1,46 @@
|
| +// Copyright 2017 The LUCI Authors. All rights reserved.
|
| +// Use of this source code is governed under the Apache License, Version 2.0
|
| +// that can be found in the LICENSE file.
|
| +
|
| +package tasktemplate
|
| +
|
| +import (
|
| + "testing"
|
| +
|
| + . "github.com/smartystreets/goconvey/convey"
|
| +)
|
| +
|
| +func TestResolve(t *testing.T) {
|
| + t.Parallel()
|
| +
|
| + Convey(`Testing substitution resolution`, t, func() {
|
| + var p Params
|
| +
|
| + Convey(`With no parameters`, func() {
|
| + v, err := p.Resolve("foo")
|
| + So(err, ShouldBeNil)
|
| + So(v, ShouldEqual, "foo")
|
| +
|
| + _, err = p.Resolve("${swarming_run_id}")
|
| + So(err, ShouldNotBeNil)
|
| +
|
| + _, err = p.Resolve("${undefined}")
|
| + So(err, ShouldNotBeNil)
|
| + })
|
| +
|
| + Convey(`With a "swarming_run_id" parameter defined.`, func() {
|
| + p.SwarmingRunID = "12345"
|
| +
|
| + v, err := p.Resolve("foo")
|
| + So(err, ShouldBeNil)
|
| + So(v, ShouldEqual, "foo")
|
| +
|
| + v, err = p.Resolve("${swarming_run_id}")
|
| + So(err, ShouldBeNil)
|
| + So(v, ShouldEqual, "12345")
|
| +
|
| + _, err = p.Resolve("${undefined}")
|
| + So(err, ShouldNotBeNil)
|
| + })
|
| + })
|
| +}
|
|
|