summaryrefslogtreecommitdiff
path: root/filesystem/filesystem_test.go
diff options
context:
space:
mode:
author Cole Faust <colefaust@google.com> 2022-01-27 17:21:41 -0800
committer Cole Faust <colefaust@google.com> 2022-01-28 19:47:34 +0000
commit71514c07d2dae1dfb1f8a88ff42d229288ddfc81 (patch)
treeb6e3f8a94f1ea37655ab43aeab8493841ffab7b9 /filesystem/filesystem_test.go
parent54f311d0fbbfcef663518bdca7a4b066486562f0 (diff)
Remove variableDefinedExpr
VariableDefinedExpr was under-developed, and would not take into account if a variable was from the globals or product config dictionary. It also always emitted `g.get("VARIABLE") != None`, which is not correct behavior. In this example makefile: ``` MY_VAR := ifdef MY_VAR $(info MY_VAR is defined) else $(info MY_VAR is not defined) endif ifdef MY_UNDEFINED_VAR $(info MY_UNDEFINED_VAR is defined) else $(info MY_UNDEFINED_VAR is not defined) endif MY_VAR ?= true MY_UNDEFINED_VAR ?= true $(info MY_VAR after ?= is $(MY_VAR)) $(info MY_UNDEFINED_VAR after ?= is $(MY_UNDEFINED_VAR)) .PHONY: all all: @: ``` We get the output: MY_VAR is not defined MY_UNDEFINED_VAR is not defined MY_VAR after ?= is MY_UNDEFINED_VAR after ?= is true So we can see that even if a variable was set, it's considered not defined if it was set to an empty value. However, ?= works differently, and does require the != None, so that was left as is. Just use a variableRefExpr and rely on the fact that variables will be truthy if they're defined. Fixes: 216700361 Test: go test Change-Id: If8944da2579e8658e3fc4f666b1f3b2815f8c8b1
Diffstat (limited to 'filesystem/filesystem_test.go')
0 files changed, 0 insertions, 0 deletions