forked from maveniverse/domtrip
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfix-tests.sh
More file actions
executable file
·39 lines (27 loc) · 1.7 KB
/
fix-tests.sh
File metadata and controls
executable file
·39 lines (27 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/bash
# Script to fix test compilation issues after API changes
echo "Fixing test compilation issues..."
# Find all Java test files
find core/src/test/java -name "*.java" -type f | while read file; do
echo "Processing $file..."
# Fix Editor(String) constructor -> Document.of(String) + Editor(Document)
sed -i 's/new Editor(\([^)]*\))/new Editor(Document.of(\1))/g' "$file"
# Fix editor.loadXml(xml) -> Document doc = Document.of(xml); Editor editor = new Editor(doc);
sed -i 's/editor\.loadXml(\([^)]*\));/Document doc = Document.of(\1); Editor editor = new Editor(doc);/g' "$file"
# Fix editor.element(name) -> doc.root().descendant(name)
sed -i 's/editor\.element(\([^)]*\))/doc.root().descendant(\1)/g' "$file"
# Fix editor.elements(name) -> doc.root().descendants(name)
sed -i 's/editor\.elements(\([^)]*\))/doc.root().descendants(\1)/g' "$file"
# Fix doc.element(name) -> doc.root().descendant(name)
sed -i 's/doc\.element(\([^)]*\))/doc.root().descendant(\1)/g' "$file"
# Fix Document.empty() -> Document.of()
sed -i 's/Document\.empty()/Document.of()/g' "$file"
# Fix Element.element(qname) -> Element.of(qname)
sed -i 's/Element\.element(\([^)]*\))/Element.of(\1)/g' "$file"
# Fix removed convenience methods - these need manual attention
# Just comment them out for now
sed -i 's/editor\.findOrCreateElement(/\/\/ FIXME: editor.findOrCreateElement(/g' "$file"
sed -i 's/editor\.setElementText(/\/\/ FIXME: editor.setElementText(/g' "$file"
sed -i 's/editor\.setElementAttribute(/\/\/ FIXME: editor.setElementAttribute(/g' "$file"
done
echo "Basic fixes applied. Some manual fixes may still be needed."