addprefix 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. $description = "The following test creates a makefile to test the addprefix "
  2. ."function.";
  3. $details = "";
  4. # IF YOU NEED >1 MAKEFILE FOR THIS TEST, USE &get_tmpfile; TO GET
  5. # THE NAME OF THE MAKEFILE. THIS INSURES CONSISTENCY AND KEEPS TRACK OF
  6. # HOW MANY MAKEFILES EXIST FOR EASY DELETION AT THE END.
  7. # EXAMPLE: $makefile2 = &get_tmpfile;
  8. open(MAKEFILE,"> $makefile");
  9. # The Contents of the MAKEFILE ...
  10. print MAKEFILE "string := \$(addprefix src${pathsep},a.b.z.foo hacks) \n"
  11. ."all: \n"
  12. ."\t\@echo \$(string) \n";
  13. # END of Contents of MAKEFILE
  14. close(MAKEFILE);
  15. &run_make_with_options($makefile,"",&get_logfile,0);
  16. # Create the answer to what should be produced by this Makefile
  17. $answer = "src${pathsep}a.b.z.foo src${pathsep}hacks\n";
  18. # COMPARE RESULTS
  19. # In this call to compare output, you should use the call &get_logfile(1)
  20. # to send the name of the last logfile created. You may also use
  21. # the special call &get_logfile(1) which returns the same as &get_logfile(1).
  22. &compare_output($answer,&get_logfile(1));
  23. # This tells the test driver that the perl test script executed properly.
  24. 1;