exercism / awk

Exercism exercises in AWK.
https://exercism.org/tracks/awk
MIT License
19 stars 22 forks source link

[two-fer] Update instructions.md #160

Closed fgm closed 2 years ago

fgm commented 2 years ago

The test sends multiple lines, but unlike what would be expected from the current description, it only expects the last one to be used. Added a line to explain that.

glennj commented 2 years ago

@IsaacG you had the same kind of question about this test earlier. Do you want to chime in?

glennj commented 2 years ago

A brain cramp: the instructions.md file is shared between tracks, so it should not be modified.

Any AWK specific instructions need to be added to instructions.append.md

IsaacG commented 2 years ago

If we don't want students to have to figure out the specific behavior, it might make more sense just to drop that test.

If we do want to bother having this input handled, we do take a TDD approach for most other exercises.

glennj commented 2 years ago

Or, the test can have a line of output for each line of input.

@test "multiple names given" {
  [[ $BATS_RUN_SKIPPED == "true" ]] || skip
  run gawk -f two-fer.awk two.txt
  assert_success
  assert_line --index 0 -- "One for John Smith, one for me."
  assert_line --index 1 -- "One for Mary Ann, one for me."
}

That would be less surprising.

Even with multiple files

@test "multiple names given" {
  [[ $BATS_RUN_SKIPPED == "true" ]] || skip
  run gawk -f two-fer.awk one.txt two.txt
  assert_success
  assert_line --index 0 -- "One for Alice, one for me."
  assert_line --index 1 -- "One for John Smith, one for me."
  assert_line --index 2 -- "One for Mary Ann, one for me."
}
glennj commented 2 years ago

@fgm would you like to change the approach to this PR and edit the test file?

glennj commented 2 years ago

@IsaacG should we remove the multiple-input test, or have the test expect a line of output for each line of input?

IsaacG commented 2 years ago

I'm in favor of just dropping it.