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

Function TestStopCommands

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

Source from the content-addressed store, hash-verified

90}
91
92func TestStopCommands(t *testing.T) {
93 logger, hook := test.NewNullLogger()
94
95 a := assert.New(t)
96 ctx := common.WithLogger(context.Background(), logger)
97 rc := new(RunContext)
98 rc.Env = map[string]string{"ACTIONS_ALLOW_UNSECURE_COMMANDS": "true"}
99 handler := rc.commandHandler(ctx)
100
101 handler("::set-env name=x::valz\n")
102 a.Equal("valz", rc.Env["x"])
103 handler("::stop-commands::my-end-token\n")
104 handler("::set-env name=x::abcd\n")
105 a.Equal("valz", rc.Env["x"])
106 handler("::my-end-token::\n")
107 handler("::set-env name=x::abcd\n")
108 a.Equal("abcd", rc.Env["x"])
109
110 messages := make([]string, 0)
111 for _, entry := range hook.AllEntries() {
112 messages = append(messages, entry.Message)
113 }
114
115 a.Contains(messages, " \U00002699 ::set-env name=x::abcd\n")
116}
117
118func TestAddpathADO(t *testing.T) {
119 a := assert.New(t)

Callers

nothing calls this directly

Calls 3

WithLoggerFunction · 0.92
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…