patch.test 2.6 KB

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