Skip to content

Commit

Permalink
fix bug in protobuf expansion (#1115)
Browse files Browse the repository at this point in the history
unchecked call to write-varint* ... with arguments in the wrong order.
:facepalm:
  • Loading branch information
vyzo authored Feb 9, 2024
1 parent db7106e commit bbefba4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/std/protobuf/macros.ss
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
((cases ...)
(map (lambda (key val)
(with-syntax ((key key) (val val))
#'((key) (&BufferedWriter-write-varint* val buf))))
#'((key) (&BufferedWriter-write-varint* buf val))))
keys vals)))
#'(defwriter-ext* (bio-write buf val)
(case val
Expand Down
16 changes: 16 additions & 0 deletions src/std/protobuf/protobuf-test.ss
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,22 @@
BufferedReader-read-Test7 BufferedWriter-write-Test7)
)

(test-case "test enum"
(defenum E
(a 1)
(b 2)
(c 3))

(defmessage A
optional: (a 1 E))

(check-marshal-unmarshal (A a: 'a)
BufferedReader-read-A BufferedWriter-write-A)
(check-marshal-unmarshal (A a: 'b)
BufferedReader-read-A BufferedWriter-write-A)
(check-marshal-unmarshal (A a: 'c)
BufferedReader-read-A BufferedWriter-write-A))

(test-case "test oneof"
(defmessage A
oneof: (a (s 1 string) (i 2 int32)))
Expand Down

0 comments on commit bbefba4

Please sign in to comment.