| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2017 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 tasktemplate |
| 6 |
| 7 import ( |
| 8 "testing" |
| 9 |
| 10 . "github.com/smartystreets/goconvey/convey" |
| 11 ) |
| 12 |
| 13 func TestResolve(t *testing.T) { |
| 14 t.Parallel() |
| 15 |
| 16 Convey(`Testing substitution resolution`, t, func() { |
| 17 var p Params |
| 18 |
| 19 Convey(`With no parameters`, func() { |
| 20 v, err := p.Resolve("foo") |
| 21 So(err, ShouldBeNil) |
| 22 So(v, ShouldEqual, "foo") |
| 23 |
| 24 _, err = p.Resolve("${swarming_run_id}") |
| 25 So(err, ShouldNotBeNil) |
| 26 |
| 27 _, err = p.Resolve("${undefined}") |
| 28 So(err, ShouldNotBeNil) |
| 29 }) |
| 30 |
| 31 Convey(`With a "swarming_run_id" parameter defined.`, func() { |
| 32 p.SwarmingRunID = "12345" |
| 33 |
| 34 v, err := p.Resolve("foo") |
| 35 So(err, ShouldBeNil) |
| 36 So(v, ShouldEqual, "foo") |
| 37 |
| 38 v, err = p.Resolve("${swarming_run_id}") |
| 39 So(err, ShouldBeNil) |
| 40 So(v, ShouldEqual, "12345") |
| 41 |
| 42 _, err = p.Resolve("${undefined}") |
| 43 So(err, ShouldNotBeNil) |
| 44 }) |
| 45 }) |
| 46 } |
| OLD | NEW |