Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/hacking.md
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ besides `done`:
| Option | What the reply needs |
|---|---|
| `new-session` | A `new-session`, which later steps can use as `$` and this name (e.g. `session = "$repl"`). |
| `snippet` | The value of this snippet of the server's profile, with all the parts it came in joined together. Its code goes in the request (in `file` for `load-file`), as it stands for the user's code. |
| `snippet` | The value of this snippet of the server's profile, with all the parts it came in joined together. Its code goes in the request (in `file` for `load-file`), as it stands for the user's code. Whitespace after the value doesn't count, as cider-nrepl's `pprint` ends values with a newline. |
| `values` | At least this many values, told apart by the `ns` that comes with each one (or after it), which is how some clients tell them apart. |
| `dicts` | These fields have to be dicts (or empty lists), if the reply has them. Each one is a list of keys, e.g. `["versions", "clojure"]`. |

Expand Down
2 changes: 2 additions & 0 deletions internal/checks/checks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@ func TestChecksCatchMisbehaviour(t *testing.T) {
"session.ephemeral": F, "session.persistent": F, "cider.eval": F, "cider.repl": F, "calva.eval": F, "conjure.eval": F, "fireplace.eval": F,
"neorepl.eval": F, "interrupt.survives": F, "interrupt.queued": F, "load-file.value": F, "robust.wrong-types": W,
"robust.disconnect": F, "robust.sessions-at-once": F, "robust.bad-frames": F})},
// Like cider-nrepl's pprint.
{"printed values end in a newline", quirks{printNewline: true}, nil},
{"unsorted keys", quirks{unsortedKeys: true}, map[string]check.Verdict{"wire.canonical": W}},
{"invalid UTF-8", quirks{badUTF8: true}, map[string]check.Verdict{"wire.utf8": W, "eval.stdout": F}},
{"no stdin op", quirks{noStdinOp: true}, map[string]check.Verdict{
Expand Down
5 changes: 4 additions & 1 deletion internal/checks/client_profiles.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,10 @@ func (c clientCheck) replay(t *check.T) {
sessions[s.NewSession] = id
}
if s.Snippet != "" {
switch got := strings.Join(resp.Values(), ""); got {
// Whitespace after the value doesn't count, as cider-nrepl's
// pprint, which Calva and Conjure ask for, ends values with a
// newline.
switch got := strings.Join(resp.Values(), ""); strings.TrimRight(got, " \t\r\n") {
case want:
case "":
t.Stopf("%s gave no value, so %s", step, s.Why)
Expand Down
4 changes: 4 additions & 0 deletions internal/checks/fake_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ type quirks struct {
noSessionEcho bool
noID bool // output messages carry no id
intValue bool // value is an integer
printNewline bool // a value printed with a print function ends in a newline
statusString bool // status "done" instead of ["done"] on unknown-op
unsortedKeys bool // describe reply has keys out of order
badUTF8 bool // out isn't valid UTF-8
Expand Down Expand Up @@ -634,6 +635,9 @@ func (s *fakeServer) eval(c net.Conn, req nrepl.Message, local map[string]bool)
if !q.noNs {
valueMsg["ns"] = "user"
}
if q.printNewline && req.Has("nrepl.middleware.print/print") {
valueMsg["value"] = value + "\n"
}
if q.intValue {
if n, err := strconv.Atoi(value); err == nil {
valueMsg["value"] = n
Expand Down
Loading