diff --git a/main.rkt b/main.rkt index 0437e6e..96847d4 100644 --- a/main.rkt +++ b/main.rkt @@ -348,12 +348,17 @@ ;; txexprs are deemed equal if they differ only in the ordering of attributes. ;; therefore, to check them, 1) sort their attributes, 2) straight list comparison. ;; use letrec because `define-simple-check` wants an expression in <=6.2 - (letrec ([symbolstring syms)))] + + ;; `stringify-attr` is needed because comparing attr keys won't work if there are two attrs with same key. + ;; so the whole attr is converted into a single string for sorting, which lets the attr value act as a tiebreaker. + (letrec ([stringify-attr (λ(attr) (string-append (symbol->string (car attr)) (cadr attr)))] [sort-attrs (λ(x) (if (txexpr? x) (let-values ([(tag attr elements) (txexpr->values x)]) - (make-txexpr tag (sort attr #:key car symbol