Home | History | Annotate | Line # | Download | only in unit-tests
dir.mk revision 1.5
      1 # $NetBSD: dir.mk,v 1.5 2020/09/07 19:48:08 rillig Exp $
      2 #
      3 # Tests for dir.c.
      4 
      5 # Dependency lines may use braces for expansion.
      6 # See DirExpandCurly for the implementation.
      7 all: {one,two,three}
      8 
      9 one:
     10 	@echo 1
     11 two:
     12 	@echo 2
     13 three:
     14 	@echo 3
     15 
     16 # The braces may start in the middle of a word.
     17 all: f{our,ive}
     18 
     19 four:
     20 	@echo 4
     21 five:
     22 	@echo 5
     23 six:
     24 	@echo 6
     25 
     26 # Nested braces work as expected since 2020-07-31 19:06 UTC.
     27 # They had been broken at least since 2003-01-01, probably even longer.
     28 all: {{thi,fou}r,fif}teen
     29 
     30 thirteen:
     31 	@echo 13
     32 fourteen:
     33 	@echo 14
     34 fifteen:
     35 	@echo 15
     36 
     37 # There may be multiple brace groups side by side.
     38 all: {pre-,}{patch,configure}
     39 
     40 pre-patch patch pre-configure configure:
     41 	@echo $@
     42 
     43 # Empty pieces are allowed in the braces.
     44 all: {fetch,extract}{,-post}
     45 
     46 fetch fetch-post extract extract-post:
     47 	@echo $@
     48 
     49 # The expansions may have duplicates.
     50 # These are merged together because of the dependency line.
     51 all: dup-{1,1,1,1,1,1,1}
     52 
     53 dup-1:
     54 	@echo $@
     55 
     56 # Other than in Bash, the braces are also expanded if there is no comma.
     57 all: {{{{{{{{{{single-word}}}}}}}}}}
     58 
     59 single-word:
     60 	@echo $@
     61