MCPcopy Create free account
hub / github.com/checkmake/checkmake / TestParse_VariableLikeRuleIsNotRule

Function TestParse_VariableLikeRuleIsNotRule

parser/parser_test.go:312–337  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

310}
311
312func TestParse_VariableLikeRuleIsNotRule(t *testing.T) {
313 t.Parallel()
314 makefile := `
315EXTENSION := .exe
316VAR ?= foo
317APPEND += bar
318SHELL != echo hi
319`
320 tmp := writeTempMakefile(t, makefile)
321 defer os.Remove(tmp)
322
323 ret, err := Parse(tmp)
324 require.NoError(t, err)
325
326 assert.Empty(t, ret.Rules, "variable assignments with ':=' or similar should not create rules")
327
328 varNames := make([]string, len(ret.Variables))
329 for i, v := range ret.Variables {
330 varNames[i] = v.Name
331 }
332
333 assert.Contains(t, varNames, "EXTENSION")
334 assert.Contains(t, varNames, "VAR")
335 assert.Contains(t, varNames, "APPEND")
336 assert.Contains(t, varNames, "SHELL")
337}

Callers

nothing calls this directly

Calls 2

writeTempMakefileFunction · 0.85
ParseFunction · 0.85

Tested by

no test coverage detected