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