chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
# Credit Note Example Repo
|
||||
|
||||
This tiny repo exists to support `examples/sandbox/docs/coding_task.py`.
|
||||
|
||||
The task is intentionally small so a sandbox coding agent can inspect the repo, apply a minimal patch, and prove the fix with one targeted shell test command.
|
||||
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh
|
||||
|
||||
customer="$1"
|
||||
amount="$2"
|
||||
|
||||
printf 'Credit note for %s: -$%s debit.\n' "$customer" "$amount"
|
||||
@@ -0,0 +1,14 @@
|
||||
# Task
|
||||
|
||||
`credit_note.sh` formats a credit note incorrectly:
|
||||
|
||||
- It prints a debit label instead of a credit label.
|
||||
- It preserves the sign instead of always showing the credited amount as positive.
|
||||
|
||||
Use the smallest correct fix, then run this exact verification command from the `repo/` directory:
|
||||
|
||||
`sh tests/test_credit_note.sh`
|
||||
|
||||
If you use `apply_patch`, the patch paths must still be relative to the sandbox workspace root. That means the file paths should be `repo/credit_note.sh` and `repo/tests/test_credit_note.sh`.
|
||||
|
||||
Do not change the test expectations.
|
||||
@@ -0,0 +1,16 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
actual_positive="$(sh credit_note.sh Northwind 12.50)"
|
||||
if [ "$actual_positive" != 'Credit note for Northwind: $12.50 credit.' ]; then
|
||||
printf 'expected positive case to pass, got: %s\n' "$actual_positive" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
actual_negative="$(sh credit_note.sh Northwind -12.50)"
|
||||
if [ "$actual_negative" != 'Credit note for Northwind: $12.50 credit.' ]; then
|
||||
printf 'expected negative case to pass, got: %s\n' "$actual_negative" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
printf '2 passed\n'
|
||||
Reference in New Issue
Block a user