diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /config/makefiles/test/check-arglist.mk | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'config/makefiles/test/check-arglist.mk')
-rw-r--r-- | config/makefiles/test/check-arglist.mk | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/config/makefiles/test/check-arglist.mk b/config/makefiles/test/check-arglist.mk new file mode 100644 index 000000000..fb720ee42 --- /dev/null +++ b/config/makefiles/test/check-arglist.mk @@ -0,0 +1,100 @@ +# -*- makefile -*- +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this file, +# You can obtain one at http://mozilla.org/MPL/2.0/. + +ifdef VERBOSE + $(warning loading test) +endif + + +$(call requiredfunction,getargv) +$(call requiredfunction,subargv) +$(call requiredfunction,istype isval isvar) + +# arg_scalar = [scalar|literal] +arg_list = foo bar +arg_ref = arg_list + +## Identify type of function argument(s) +######################################## +ifneq (scalar,$(call istype,arg_scalar)) + $(error istype(arg_scalar)=scalar, found [$(call istype,arg_scalar)]) +endif +ifneq (list,$(call istype,arg_list)) + $(error istype(arg_list)=list, found [$(call istype,arg_list)]) +endif +ifneq (list,$(call istype,arg_ref)) + $(error istype(arg_ref)=list, found [$(call istype,arg_ref)]) +endif + +## Type == scalar or a list of values +##################################### +ifneq (true,$(call isval,scalar)) + $(error isval(scalar)=true, found [$(call isval,scalar)]) +endif +ifneq ($(NULL),$(call isval,arg_list)) + $(error isval(arg_list)=null, found [$(call isval,arg_list)]) +endif + +## type == reference: macro=>macro => $($(1)) +############################################# +ifneq ($(NULL),$(call isvar,scalar)) + $(error isvar(scalar)=$(NULL), found [$(call isvar,scalar)]) +endif +ifneq (true,$(call isvar,arg_list)) + $(error isvar(arg_list)=true, found [$(call isvar,arg_list)]) +endif +ifneq (true,$(call isvar,arg_ref)) + $(error isvar(arg_ref)=true, found [$(call isvar,arg_ref)]) +endif + +# Verify getargv expansion +########################## +ifneq (scalar,$(call getargv,scalar)) + $(error getargv(scalar)=scalar, found [$(call getargv,scalar)]) +endif +ifneq ($(arg_list),$(call getargv,arg_list)) + $(error getargv(arg_list)=list, found [$(call getargv,arg_list)]) +endif +ifneq (arg_list,$(call getargv,arg_ref)) + $(error getargv(arg_ref)=list, found [$(call getargv,arg_ref)]) +endif + +########################################################################### +## +########################################################################### +ifdef MANUAL_TEST #{ + # For automated testing a callback is needed that can set an external status + # variable that can be tested. Syntax is tricky to get correct functionality. + ifdef VERBOSE + $(info ) + $(info ===========================================================================) + $(info Running test: checkIfEmpty) + $(info ===========================================================================) + endif + + #status = + #setTRUE =status=true + #setFALSE =status=$(NULL) + #$(call checkIfEmpty,setFALSE NULL) + #$(if $(status),$(error checkIfEmpty(xyz) failed)) + #$(call checkIfEmpty,setTRUE xyz) + #$(if $(status),$(error checkIfEmpty(xyz) failed)) + xyz=abc + $(info STATUS: warnIfEmpty - two vars) + $(call warnIfEmpty,foo xyz bar) + $(info STATUS: errorIfEmpty - on first var) + $(call errorIfEmpty,foo xyz bar) + $(error TEST FAILED: processing should not reach this point) +endif #} + +# Verify subargv expansion +########################## +subargs=foo bar tans fans +subargs_exp=tans fans +subargs_found=$(call subargv,4,$(subargs)) +ifneq ($(subargs_exp),$(subargs_found)) + $(error subargv(4,$(subargs)): expected [$(subargs_exp)] found [$(subargs_found)]) +endif |