MCPcopy
hub / github.com/nektos/act / TestSetOutput

Function TestSetOutput

pkg/runner/command_test.go:38–66  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

36}
37
38func TestSetOutput(t *testing.T) {
39 a := assert.New(t)
40 ctx := context.Background()
41 rc := new(RunContext)
42 rc.StepResults = make(map[string]*model.StepResult)
43 handler := rc.commandHandler(ctx)
44
45 rc.CurrentStep = "my-step"
46 rc.StepResults[rc.CurrentStep] = &model.StepResult{
47 Outputs: make(map[string]string),
48 }
49 handler("::set-output name=x::valz\n")
50 a.Equal("valz", rc.StepResults["my-step"].Outputs["x"])
51
52 handler("::set-output name=x::percent2%25\n")
53 a.Equal("percent2%", rc.StepResults["my-step"].Outputs["x"])
54
55 handler("::set-output name=x::percent2%25%0Atest\n")
56 a.Equal("percent2%\ntest", rc.StepResults["my-step"].Outputs["x"])
57
58 handler("::set-output name=x::percent2%25%0Atest another3%25test\n")
59 a.Equal("percent2%\ntest another3%test", rc.StepResults["my-step"].Outputs["x"])
60
61 handler("::set-output name=x%3A::percent2%25%0Atest\n")
62 a.Equal("percent2%\ntest", rc.StepResults["my-step"].Outputs["x:"])
63
64 handler("::set-output name=x%3A%2C%0A%25%0D%3A::percent2%25%0Atest\n")
65 a.Equal("percent2%\ntest", rc.StepResults["my-step"].Outputs["x:,\n%\r:"])
66}
67
68func TestAddpath(t *testing.T) {
69 a := assert.New(t)

Callers

nothing calls this directly

Calls 2

makeFunction · 0.85
commandHandlerMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…