patch.test 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. #!/bin/bash
  2. [ -f testing.sh ] && . testing.sh
  3. #testing "name" "command" "result" "infile" "stdin"
  4. testing "create file" "patch >/dev/null && cat bork" "one\ntwo\nthree\n" "" "
  5. --- /dev/null
  6. +++ bork
  7. @@ -0,0 +1,3 @@
  8. +one
  9. +two
  10. +three
  11. "
  12. testing "insert in middle" "patch > /dev/null && cat bork" \
  13. "one\nfour\ntwo\nthree\n" "" "
  14. --- bork
  15. +++ bork
  16. @@ -1,3 +1,4 @@
  17. one
  18. +four
  19. two
  20. three
  21. "
  22. testing "append at end" "patch > /dev/null && cat bork" \
  23. "one\nfour\ntwo\nthree\nfive\nsix\n" "" "
  24. --- bork
  25. +++ bork
  26. @@ -2,3 +2,5 @@
  27. four
  28. two
  29. three
  30. +five
  31. +six
  32. "
  33. testing "insert at start" "patch > /dev/null && cat bork" \
  34. "seven\none\nfour\ntwo\nthree\nfive\nsix\n" "" "
  35. --- bork
  36. +++ bork
  37. @@ -1,3 +1,4 @@
  38. +seven
  39. one
  40. four
  41. two
  42. "
  43. testing "delete at end" "patch > /dev/null && cat bork" \
  44. "seven\none\nfour\ntwo\nthree\nfive\n" "" "
  45. --- bork
  46. +++ bork
  47. @@ -4,4 +4,3 @@
  48. two
  49. three
  50. five
  51. -six
  52. "
  53. testing "delete at start" "patch > /dev/null && cat bork" \
  54. "four\ntwo\nthree\nfive\n" "" "
  55. --- bork
  56. +++ bork
  57. @@ -1,5 +1,3 @@
  58. -seven
  59. -one
  60. four
  61. two
  62. three
  63. "
  64. testing "filter timestamps" "patch > /dev/null && cat bork" \
  65. "four\ntwo\nthree\neight\nfive\n" "" "
  66. --- bork 2019-12-20 16:54:35.735630973 -0600
  67. +++ bork 2019-12-20 16:57:03.083625706 -0600
  68. @@ -1,4 +1,5 @@
  69. four
  70. two
  71. three
  72. +eight
  73. five
  74. "
  75. testing "quoted name" "patch > /dev/null && cat 'fruit bat'" \
  76. "hello\n" "" '
  77. --- /dev/null
  78. +++ "fruit bat"
  79. @@ -0,0 +1 @@
  80. +hello
  81. '
  82. # todo bork bork2
  83. # We hit a bug, test the bugfix.
  84. testing "fuzz" "patch > /dev/null && cat input" \
  85. "blah blah
  86. */
  87. package org.yaml.snakeyaml.representer;
  88. import java.util.ArrayList;
  89. import java.util.Arrays;
  90. import java.util.Collections;
  91. import java.util.Iterator;
  92. " "blah blah
  93. */
  94. package org.yaml.snakeyaml.representer;
  95. import java.beans.IntrospectionException;
  96. import java.util.ArrayList;
  97. import java.util.Arrays;
  98. import java.util.Collections;
  99. import java.util.Iterator;
  100. " "--- a/x/input
  101. +++ b/x/input
  102. @@ -15,7 +15,6 @@
  103. */
  104. package org.yaml.snakeyaml.representer;
  105. -import java.beans.IntrospectionException;
  106. import java.util.ArrayList;
  107. import java.util.Arrays;
  108. import java.util.Iterator;
  109. "