-
Notifications
You must be signed in to change notification settings - Fork 15
/
convert.sh
executable file
·22 lines (20 loc) · 999 Bytes
/
convert.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash
echo "Replacing in $1..."
echo
sed -i "" "s/package\s*\(.*\)/package \1_test/" $1
sed -i "" "s/g.Assert/Expect/" $1
sed -i "" "s/g.Describe/Describe/" $1
sed -i "" "s/g.It/It/" $1
sed -i "" "s/Expect[(]err != nil[)].IsTrue[(][)]/Expect(err).To(HaveOccurred())/" $1
sed -i "" "s/Expect[(]err == nil[)].IsTrue[(][)]/Expect(err).NotTo(HaveOccurred())/" $1
sed -i "" "s@\s*[>]\s*\(.*\)[)].IsTrue[(][)]@).To(BeNumerically(\">\", \1))@" $1
sed -i "" "s@\s*[!][=]\s*\(.*\)[)].IsTrue[(][)]@).NotTo(BeEquivalentTo(\1))@" $1
sed -i "" "s/Expect.err == nil..IsFalse../Expect(err).To(HaveOccurred())/" $1
sed -i "" "s@[= ]*nil[)].IsTrue[(][)]@).To(BeNil())@" $1
sed -i "" "s@[)][.]\(Equal.*[)]\)@).To(\1)@" $1
sed -i "" "s@[)][.]\(Equal.*\)@).To(\1@" $1
sed -i "" "s@[(]int[(]\(.*\)[)][)].To[(]Equal@(\1).To(BeEquivalentTo@" $1
sed -i "" "s@IsFalse[(][)]@To(BeFalse())@" $1
sed -i "" "s@IsTrue[(][)]@To(BeTrue())@" $1
sed -i "" "s@Equal[(]nil[)]@To(BeNil())@" $1
sed -i "" "s/To[(]To[(]/To(/" $1