Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: assert messages #6096

Merged
merged 5 commits into from
Mar 29, 2024
Merged

feat: assert messages #6096

merged 5 commits into from
Mar 29, 2024

Conversation

Chriscbr
Copy link
Contributor

This PR adds support for writing custom assertion messages with the built-in assert() function:

let x = -3;
assert(x >= 0, "x must be non-negative");

Checklist

  • Title matches Winglang's style guide
  • Description explains motivation and solution
  • Tests added (always)
  • Docs updated (only required for features)
  • Added pr/e2e-full label if this feature requires end-to-end testing

By submitting this pull request, I confirm that my contribution is made under the terms of the Wing Cloud Contribution License.

@Chriscbr Chriscbr requested a review from a team as a code owner March 29, 2024 19:19
Copy link

Thanks for opening this pull request! 🎉
Please consult the contributing guidelines for details on how to contribute to this project.
If you need any assistence, don't hesitate to ping the relevant owner over Slack.

Topic Owner
Wing SDK and utility APIs @chriscbr
Wing Console @ainvoner, @skyrpex, @polamoros
JSON, structs, primitives and collections @hasanaburayyan
Platforms and plugins @hasanaburayyan
Frontend resources (website, react, etc) @tsuf239
Language design @chriscbr
VSCode extension and language server @markmcculloh
Compiler architecture, inflights, lifting @yoav-steinberg
Wing Testing Framework @tsuf239
Wing CLI @markmcculloh
Build system, dev environment, releases @markmcculloh
Library Ecosystem @chriscbr
Documentation @hasanaburayyan
SDK test suite @tsuf239
Examples @hasanaburayyan
Wing Playground @eladcon

@monadabot
Copy link
Contributor

monadabot commented Mar 29, 2024

Console preview environment is available at https://wing-console-pr-6096.fly.dev 🚀

Last Updated (UTC) 2024-03-29 19:36

@monadabot
Copy link
Contributor

monadabot commented Mar 29, 2024

Benchmarks

Comparison to Baseline ⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜
Benchmark Before After Change
version 59ms±0.47 58ms±0.64 0ms (-0.66%)⬜
empty.test.w -t sim 403ms±45.39 353ms±3.36 -50ms (-12.37%)⬜
empty.test.w -t tf-aws 595ms±4.64 593ms±4.8 -1ms (-0.21%)⬜
hello_world.test.w -t sim 392ms±6.94 390ms±8.5 -2ms (-0.39%)⬜
hello_world.test.w -t tf-aws 1532ms±10.31 1531ms±24.83 -1ms (-0.06%)⬜
functions_10.test.w -t sim 474ms±4.83 461ms±9.67 -13ms (-2.8%)⬜
functions_10.test.w -t tf-aws 2135ms±11.36 2132ms±14.19 -3ms (-0.14%)⬜
jsii_small.test.w -t sim 367ms±2.91 362ms±4.35 -6ms (-1.54%)⬜
jsii_small.test.w -t tf-aws 612ms±6.65 610ms±5.26 -2ms (-0.36%)⬜
jsii_big.test.w -t sim 2774ms±9.91 2788ms±16.58 +14ms (+0.52%)⬜
jsii_big.test.w -t tf-aws 2998ms±16.17 3002ms±9.6 +4ms (+0.12%)⬜
functions_1.test.w -t sim 385ms±7.09 383ms±3.45 -2ms (-0.48%)⬜
functions_1.test.w -t tf-aws 819ms±4.94 824ms±5.82 +5ms (+0.62%)⬜

⬜ Within 1.5 standard deviations
🟩 Faster, Above 1.5 standard deviations
🟥 Slower, Above 1.5 standard deviations

Benchmarks may vary outside of normal expectations, especially when running in GitHub Actions CI.

Results
name mean min max moe sd
version 58ms 57ms 60ms 1ms 1ms
empty.test.w -t sim 353ms 341ms 358ms 3ms 5ms
empty.test.w -t tf-aws 593ms 580ms 600ms 5ms 7ms
hello_world.test.w -t sim 390ms 380ms 421ms 9ms 12ms
hello_world.test.w -t tf-aws 1531ms 1495ms 1623ms 25ms 35ms
functions_10.test.w -t sim 461ms 442ms 480ms 10ms 14ms
functions_10.test.w -t tf-aws 2132ms 2104ms 2162ms 14ms 20ms
jsii_small.test.w -t sim 362ms 352ms 369ms 4ms 6ms
jsii_small.test.w -t tf-aws 610ms 596ms 619ms 5ms 7ms
jsii_big.test.w -t sim 2788ms 2763ms 2841ms 17ms 23ms
jsii_big.test.w -t tf-aws 3002ms 2974ms 3018ms 10ms 13ms
functions_1.test.w -t sim 383ms 376ms 391ms 3ms 5ms
functions_1.test.w -t tf-aws 824ms 809ms 841ms 6ms 8ms
Last Updated (UTC) 2024-03-29 19:41

@monadabot monadabot added the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Mar 29, 2024
@Chriscbr Chriscbr removed the ⚠️ pr/review-mutation PR has been mutated and will not auto-merge. Clear this label if the changes look good! label Mar 29, 2024
Copy link
Contributor

@hasanaburayyan hasanaburayyan left a comment

Choose a reason for hiding this comment

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

🎉 farewell to the days of assert(false) // this should not happen

Copy link
Contributor

mergify bot commented Mar 29, 2024

Thanks for contributing, @Chriscbr! This PR will now be added to the merge queue, or immediately merged if rybickic/assert-message is up-to-date with main and the queue is empty.

mergify bot added a commit that referenced this pull request Mar 29, 2024
@mergify mergify bot merged commit 4c03dd8 into main Mar 29, 2024
15 checks passed
@mergify mergify bot deleted the rybickic/assert-message branch March 29, 2024 21:18
@monadabot
Copy link
Contributor

Congrats! 🚀 This was released in Wing 0.66.5.

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.

3 participants