-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_errors.sh
More file actions
executable file
·85 lines (73 loc) · 1.73 KB
/
test_errors.sh
File metadata and controls
executable file
·85 lines (73 loc) · 1.73 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
echo "=== ReactXPy Error Handling Demo ==="
echo
# Test 1: Incomplete Assignment (RX203)
echo "Test 1: Incomplete Assignment"
echo "------------------------------"
cat > /tmp/test_error.pysx << 'EOF'
def App():
x =
return <div>Test</div>
EOF
echo "Input:"
cat /tmp/test_error.pysx
echo
echo "Output:"
reactxpy /tmp/test_error.pysx -o /tmp/out.js 2>&1
echo
# Test 2: Empty Attribute (RX206)
echo "Test 2: Empty Attribute Value"
echo "------------------------------"
cat > /tmp/test_error.pysx << 'EOF'
def App():
return <input value= />
EOF
echo "Input:"
cat /tmp/test_error.pysx
echo
echo "Output:"
reactxpy /tmp/test_error.pysx -o /tmp/out.js 2>&1
echo
# Test 3: Incomplete If Statement (RX208)
echo "Test 3: Incomplete If Statement"
echo "------------------------------"
cat > /tmp/test_error.pysx << 'EOF'
def App():
if:
return <div>Test</div>
EOF
echo "Input:"
cat /tmp/test_error.pysx
echo
echo "Output:"
reactxpy /tmp/test_error.pysx -o /tmp/out.js 2>&1
echo
# Test 4: Empty Lambda (RX209)
echo "Test 4: Empty Lambda Expression"
echo "------------------------------"
cat > /tmp/test_error.pysx << 'EOF'
def App():
useEffect(lambda:)
return <div>Test</div>
EOF
echo "Input:"
cat /tmp/test_error.pysx
echo
echo "Output:"
reactxpy /tmp/test_error.pysx -o /tmp/out.js 2>&1
echo
# Test 5: Valid Code (Should Compile)
echo "Test 5: Valid Code (Should Compile Successfully)"
echo "------------------------------"
cat > /tmp/test_valid.pysx << 'EOF'
def App():
count, setCount = useState(0)
return <button onClick={lambda: setCount(count + 1)}>{count}</button>
EOF
echo "Input:"
cat /tmp/test_valid.pysx
echo
echo "Output:"
reactxpy /tmp/test_valid.pysx -o /tmp/out.js 2>&1
echo
echo "=== Demo Complete ==="