Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

クローズ 初心者向け
#635 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
83/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
go
領域
testing

調査の方向性

builtins/sort/sort_test.go:380-415 の既存の入力ソーステストと、tests/scenarios/cmd/sort/basic/ 以下のシナリオテストを読んでください。説明されているファイルと、繰り返し指定する - オペランドを使って、提案されたケース tests/scenarios/cmd/sort/basic/mixed_files_repeated_stdin.yaml を追加してください。go test ./tests -run '^TestShellScenarios$/cmd/sort' を実行してください。このケースが成功し、終端されていないレコードが別々に扱われた期待どおりのソート済み出力を確認できれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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

主要言語
Go
スター
31
フォーク
3
平均マージ
2日 23時間
マージ済み PR(30日)
13

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

DataDog/rshell のほかの issue

DataDog/rshell の issue をすべて見る

似ている issue

Go の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。