@@ -1419,16 +1419,12 @@ func TestDiffMainWithTimeout(t *testing.T) {
1419
1419
}
1420
1420
1421
1421
func TestDiffMainWithCheckLines (t * testing.T ) {
1422
+ // Test cases must be at least 100 chars long to pass the cutoff.
1422
1423
type TestCase struct {
1423
1424
Text1 string
1424
1425
Text2 string
1425
1426
}
1426
-
1427
- dmp := New ()
1428
- dmp .DiffTimeout = 0
1429
-
1430
- // Test cases must be at least 100 chars long to pass the cutoff.
1431
- for i , tc := range []TestCase {
1427
+ tests := []TestCase {
1432
1428
{
1433
1429
"1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n " ,
1434
1430
"abcdefghij\n abcdefghij\n abcdefghij\n abcdefghij\n abcdefghij\n abcdefghij\n abcdefghij\n abcdefghij\n abcdefghij\n abcdefghij\n abcdefghij\n abcdefghij\n abcdefghij\n " ,
@@ -1441,7 +1437,39 @@ func TestDiffMainWithCheckLines(t *testing.T) {
1441
1437
"1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n 1234567890\n " ,
1442
1438
"abcdefghij\n 1234567890\n 1234567890\n 1234567890\n abcdefghij\n 1234567890\n 1234567890\n 1234567890\n abcdefghij\n 1234567890\n 1234567890\n 1234567890\n abcdefghij\n " ,
1443
1439
},
1444
- } {
1440
+ }
1441
+ // Add test case for the issue #115
1442
+ func () {
1443
+ const before = `package main
1444
+
1445
+ import (
1446
+ "fmt"
1447
+ )
1448
+
1449
+ /*
1450
+ func upload(c echo.Context) error {
1451
+ if err := r.ParseForm(); err != nil {
1452
+ fmt.Fprintf(w, "ParseForm() err: %v", err)
1453
+ return
1454
+ }
1455
+ fmt.Fprintf(w, "POST request successful")
1456
+ path_ver := r.FormValue("path_ver")
1457
+ ukclin_ver := r.FormValue("ukclin_ver")
1458
+
1459
+ fmt.Fprintf(w, "Name = %s\n", path_ver)
1460
+ fmt.Fprintf(w, "Address = %s\n", ukclin_ver)
1461
+ }
1462
+ */
1463
+ `
1464
+ after := strings .ReplaceAll (before , "\n " , "\r \n " )
1465
+
1466
+ tests = append (tests , TestCase {Text1 : before , Text2 : after })
1467
+ }()
1468
+
1469
+ dmp := New ()
1470
+ dmp .DiffTimeout = 0
1471
+
1472
+ for i , tc := range tests {
1445
1473
resultWithoutCheckLines := dmp .DiffMain (tc .Text1 , tc .Text2 , false )
1446
1474
resultWithCheckLines := dmp .DiffMain (tc .Text1 , tc .Text2 , true )
1447
1475
0 commit comments