3 $description = 'Test the $(file ...) function.';
12 $(file >file.out,$(A))
13 $(foreach L,$(B),$(file >> file.out,$L))
14 x:;@echo hi; cat file.out
16 '', "hi\na\nb\nc\nd");
20 # Test >> to a non-existent file
26 $(file >> file.out,$(A))
33 # Test > with no content
41 # Test >> with no content
50 # Test > to a read-only file
51 if (defined $ERR_read_only_file) {
53 chmod(0444, 'file.out');
60 $(file > file.out,$(A))
63 '', "#MAKEFILE#:6: *** open: file.out: $ERR_read_only_file. Stop.",
69 # Use variables for operator and filename
77 $(file $(OP) $(FN),$(A))
84 # Don't add newlines if one already exists
91 $(file >file.out,$(A))
110 $(file >file.out,A = foo)
111 X1 := $(file <file.out)
112 $(file >>file.out,B = bar)
113 $(eval $(file <file.out))
115 x:;@echo '$(X1)'; echo '$(A)'; echo '$(B)'
117 '', "A = foo\nfoo\nbar\n");
121 # Reading from non-existent file
123 X1 := $(file <file.out)
128 # Extra arguments in read mode
130 X1 := $(file <file.out,foo)
133 '', "#MAKEFILE#:2: *** file: too many arguments. Stop.\n", 512);
137 run_make_test('$(file >)', '',
138 "#MAKEFILE#:1: *** file: missing filename. Stop.\n", 512);
140 run_make_test('$(file >>)', '',
141 "#MAKEFILE#:1: *** file: missing filename. Stop.\n", 512);
143 run_make_test('$(file <)', '',
144 "#MAKEFILE#:1: *** file: missing filename. Stop.\n", 512);
148 run_make_test('$(file foo)', '',
149 "#MAKEFILE#:1: *** file: invalid file operation: foo. Stop.\n", 512);