MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / TestParseLsOutput_Linux

Function TestParseLsOutput_Linux

internal/bridge/modules_test.go:378–445  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

376}
377
378func TestParseLsOutput_Linux(t *testing.T) {
379 t.Parallel()
380 resp := parseLsOutput(linuxLsOutput, "Linux", "/home/john/project")
381
382 if !resp.Exists {
383 t.Error("expected Exists=true")
384 }
385
386 if len(resp.Files) == 0 {
387 t.Fatal("expected files, got 0")
388 }
389
390 // Verify .dockerignore (regular file).
391 found := false
392 for _, f := range resp.Files {
393 if f.Name == ".dockerignore" && !f.IsDir && f.Size == 487 {
394 found = true
395 if f.Mode == 0 {
396 t.Error("expected non-zero mode for .dockerignore")
397 }
398 break
399 }
400 }
401 if !found {
402 t.Error("expected .dockerignore file with size 487")
403 }
404
405 // Verify .git (directory).
406 found = false
407 for _, f := range resp.Files {
408 if f.Name == ".git" && f.IsDir {
409 found = true
410 break
411 }
412 }
413 if !found {
414 t.Error("expected .git directory")
415 }
416
417 // Verify symlink: link -> target.
418 found = false
419 for _, f := range resp.Files {
420 if f.Name == "link" && f.Link == "target" {
421 found = true
422 break
423 }
424 }
425 if !found {
426 t.Error("expected symlink 'link' -> 'target'")
427 }
428
429 // Verify cliproxy.exe is an executable.
430 for _, f := range resp.Files {
431 if f.Name == "cliproxy.exe" {
432 if f.Mode&0100 == 0 {
433 t.Error("expected execute permission on cliproxy.exe")
434 }
435 break

Callers

nothing calls this directly

Calls 2

parseLsOutputFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected