Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Cerrado Apto para principiantes
#635 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
83/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
go
Área
testing

Línea de trabajo

Lee las pruebas existentes de fuentes de entrada en builtins/sort/sort_test.go:380-415 y las pruebas de escenarios en tests/scenarios/cmd/sort/basic/. Añade el caso sugerido tests/scenarios/cmd/sort/basic/mixed_files_repeated_stdin.yaml con los archivos descritos y operandos - repetidos. Ejecuta go test ./tests -run '^TestShellScenarios$/cmd/sort'; la tarea estará hecha cuando el caso pase y confirme la salida ordenada esperada con registros separados sin terminación.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Go
Estrellas
31
Forks
3
Merge medio
2 d 23 h
PR fusionados (30 d)
13

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de DataDog/rshell

Todos los issues de DataDog/rshell

Issues similares

Más issues de Go

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.