joy.at 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. # Joy -- implementation of the Joy programming language
  2. # Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
  3. #
  4. # Joy is free software; you can redistribute it and/or modify it under
  5. # the terms of the GNU General Public License as published by the Free
  6. # Software Foundation; either version 3 of the License, or (at your
  7. # option) any later version.
  8. #
  9. # Joy is distributed in the hope that it will be useful, but WITHOUT
  10. # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  11. # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
  12. # License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with Joy. If not, see <http://www.gnu.org/licenses/>.
  16. AT_BANNER([Joy])
  17. AT_SETUP([version])
  18. AT_CHECK([joy --version],[0],[stdout])
  19. AT_CHECK([$GREP --quiet "]AT_PACKAGE_VERSION[" stdout])
  20. AT_CLEANUP
  21. AT_SETUP([help])
  22. AT_CHECK([joy --help],[0],[stdout])
  23. AT_CHECK([$GREP --quiet "Usage:" stdout])
  24. AT_CHECK([$GREP --quiet -- "--help" stdout])
  25. AT_CHECK([$GREP --quiet -- "--version" stdout])
  26. AT_CLEANUP
  27. AT_SETUP([script])
  28. AT_DATA([foo.joy],
  29. ["base" include
  30. "Hello, world!" putchars
  31. ])
  32. AT_CHECK([joy foo.joy],[0],[stdout])
  33. AT_CHECK([$GREP --quiet 'Hello, world!' stdout])
  34. AT_CLEANUP
  35. AT_SETUP([multiple scripts])
  36. AT_DATA([foo.joy], [3 2 1 +
  37. ])
  38. AT_DATA([bar.joy],
  39. ["base" include
  40. "product: " putchars
  41. * .
  42. ])
  43. AT_CHECK([joy foo.joy bar.joy],[0],[stdout])
  44. AT_CHECK([$GREP --quiet "product: 9" stdout])
  45. AT_CLEANUP
  46. AT_SETUP([include dirs])
  47. AT_CHECK([mkdir -p dir])
  48. AT_DATA([dir/foo.joy],
  49. ["base" include
  50. "hello" cdr 'H putch putchars
  51. ])
  52. AT_CHECK([joy -I dir foo.joy],[0],[stdout])
  53. AT_CHECK([$GREP --quiet "Hello" stdout])
  54. AT_CLEANUP
  55. AT_SETUP([stack init])
  56. AT_DATA([foo.joy],[+ .
  57. ])
  58. AT_CHECK([joy foo.joy -S 1 2],[0],[stdout])
  59. AT_CHECK([$GREP --quiet "3" stdout])
  60. AT_CHECK([joy foo.joy --stack 1 2 5],[0],[stdout])
  61. AT_CHECK([$GREP --quiet "7" stdout])
  62. AT_CLEANUP