Skip to content

Move =? cond to function to reduce generated code - #40

Merged
seancorfield merged 1 commit into
clojure-expectations:developfrom
NoahTheDuke:nb/=-impl
Nov 22, 2024
Merged

Move =? cond to function to reduce generated code#40
seancorfield merged 1 commit into
clojure-expectations:developfrom
NoahTheDuke:nb/=-impl

Conversation

@NoahTheDuke

Copy link
Copy Markdown
Contributor

Related to NoahTheDuke/lazytest#13, this moves the big cond block from =? to a separate function, which reduces generated code size. I also changed the msg generation to be eager so (pr-str e') and (pr-str (list 'expect e' a)) don't bloat the generated code either.

(t/do-report
{:type :fail,
:message (if m# (if ~msg (str ~msg "\n" m#) m#) ~msg)
:message (if m# (if-let [msg# ~msg] (str msg# "\n" m#) m#) ~msg)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also evals msg once so it doesn't put a potentially big msg in multiple times (in addition to wasting effort executing it multiple times).

@seancorfield
seancorfield merged commit d7763b9 into clojure-expectations:develop Nov 22, 2024
@seancorfield

Copy link
Copy Markdown
Contributor

Have you made this change to LazyTest too, since you copied over a bunch of Expectations stuff?

seancorfield added a commit that referenced this pull request Nov 22, 2024
Signed-off-by: Sean Corfield <sean@corfield.org>
@NoahTheDuke
NoahTheDuke deleted the nb/=-impl branch November 22, 2024 22:31
@NoahTheDuke

Copy link
Copy Markdown
Contributor Author

Yeah I'm gonna move this over when I get a minute.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants