TestPackageLevelMatchReader tests the package-level MatchReader function.
(t *testing.T)
| 298 | |
| 299 | // TestPackageLevelMatchReader tests the package-level MatchReader function. |
| 300 | func TestPackageLevelMatchReader(t *testing.T) { |
| 301 | reader := strings.NewReader("hello 123") |
| 302 | matched, err := MatchReader(`\d+`, reader) |
| 303 | if err != nil { |
| 304 | t.Fatalf("MatchReader error: %v", err) |
| 305 | } |
| 306 | if !matched { |
| 307 | t.Error("MatchReader should have matched") |
| 308 | } |
| 309 | |
| 310 | // Test with invalid pattern |
| 311 | reader = strings.NewReader("test") |
| 312 | _, err = MatchReader(`[invalid`, reader) |
| 313 | if err == nil { |
| 314 | t.Error("MatchReader with invalid pattern should return error") |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | // TestExpandStdlibCompat tests Expand compatibility with stdlib. |
| 319 | func TestExpandStdlibCompat(t *testing.T) { |
nothing calls this directly
no test coverage detected