Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[correctness][missing-coverage][sort] Mixed files and repeated stdin lack a regression test

Đang mở Phù hợp với người mới
#635 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
83/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go
Lĩnh vực
testing

Hướng nghiên cứu

Đọc các bài kiểm thử hiện có về nguồn đầu vào trong builtins/sort/sort_test.go:380-415 và các bài kiểm thử kịch bản trong tests/scenarios/cmd/sort/basic/. Thêm trường hợp được đề xuất tests/scenarios/cmd/sort/basic/mixed_files_repeated_stdin.yaml bằng các tệp đã mô tả và các toán hạng - lặp lại. Chạy go test ./tests -run '^TestShellScenarios$/cmd/sort'; công việc hoàn tất khi trường hợp này chạy qua và xác nhận đầu ra đã sắp xếp như mong đợi với các bản ghi không có ký tự kết thúc được tách riêng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Generated by the rshell behavior correctness scanner.

  • Contract: BEH-004
  • Classification: missing-coverage
  • Impact: low
  • Target: sort
  • Scanned commit: 514d1cb8188fda6b1accca5955dfab3b0e8aa34a

Existing tests cover stdin, one '-' operand, multiple files, and unterminated records separately. They do not meaningfully cover their interaction: a file followed by repeated '-' operands must consume stdin once and preserve separate record boundaries when both inputs lack final newlines. The tested behavior matched GNU; no defect was demonstrated.

Contract sources
  • docs/BEHAVIOR_CONTRACTS.md:45-49: Standard input, '-', file operands, and multiple inputs must interact like the reference command.
  • sort --help: Command help promises sorted concatenation and stdin reading for '-' operands.
  • builtins/sort/sort_test.go:380-415: Existing input-source tests exercise these cases separately.
Implementation references
  • builtins/sort/sort.go:372-387: Operands are read individually and their records appended before sorting.
  • builtins/sort/sort.go:427-446: Each '-' operand wraps the same stdin reader.

Fixture setup

Create data.txt with exact bytes "b\nd" and stdin.txt with exact bytes "c\na" in a fresh temporary directory. Neither file ends with a newline.

Reproducer

sort data.txt - - < stdin.txt

Commands used:

  • GOENV_VERSION=1.26.3 timeout 300s go build -o /tmp/zz_correctness_scan_rshell ./cmd/rshell
  • In a fresh fixture directory: /tmp/zz_correctness_scan_rshell --allowed-commands rshell:sort --allowed-paths "$PWD" -c 'sort data.txt - - < stdin.txt'
  • In an equivalent fresh fixture directory: LC_ALL=C bash --noprofile --norc -c 'sort data.txt - - < stdin.txt'
  • GOENV_VERSION=1.26.3 timeout 300s go test ./tests -run '^TestShellScenarios$/cmd/sort' -count=2 -v

Verification

  • Reproduction runs: 4
  • Reference: GNU sort 9.4 matched the expected result twice from fresh fixtures. Both CLI executions and both temporary scenario executions passed.
  • Temporary test: tests/scenarios/cmd/sort/zz_correctness_scan_cases/zz_correctness_scan_mixed_inputs.yaml (removed)
  • Suggested regression-test location: tests/scenarios/cmd/sort/basic/mixed_files_repeated_stdin.yaml

Fingerprint: f38bb9f21b7f40b8e04041b1bb63daaa0387a24dcc0256fd43134ff98b63622f

Ngôn ngữ chính
Go
Star
31
Fork
3
Merge trung bình
2 ngày 11 giờ
Pull request đã merge (30 ngày)
13

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của DataDog/rshell

Tất cả issue của DataDog/rshell

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.