ed.tests 350 B

123456789101112131415161718192021
  1. #!/bin/sh
  2. . ./testing.sh
  3. # testing "test name" "command" "expected result" "file input" "stdin"
  4. testing "ed insert text before current line" \
  5. "ed input" "8\n1\ntext\n2\n3\n4\n13\n" "1\n2\n3\n4\n" '2i
  6. text
  7. .
  8. ,p
  9. w
  10. q
  11. '
  12. testing "ed read text before current line" \
  13. "ed input" "8\n8\n1\n2\n1\n2\n3\n4\n3\n4\n16\n" "1\n2\n3\n4\n" '2r input
  14. ,p
  15. w
  16. q
  17. '