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: improve malformed test attribute error #6414

Merged
merged 3 commits into from
Oct 30, 2024

Conversation

asterite
Copy link
Collaborator

Description

Problem

Resolves #4676

Summary

In reality we were producing an error message for this snippet:

#[test(should_fail_with("Arrays not equal"))]
fn foo() {}

though the error message said that it couldn't find a test function. The reason is that the lexer couldn't parse the attribute contents well: it split the attribute contents when ( and ) were found and tried to match that to some expected format, but because here we have nested parentheses it didn't work. What I did is try to parse that by checking the first and last parentheses.

I also didn't know you could write #[test(should_fail)] so I added that as an LSP autocompletion.

Additional Context

I'm thinking that maybe the attribute contents should be parsed by lexing its contents. With that, we could also keep a nesting counter when [ and ] are found, to allow arrays in attributes (it's tricky without lexing the contents because [ might appear inside a string literal, etc.). But for now this slightly improves the current situation.

Documentation

Check one:

  • No documentation needed.
  • Documentation included in this PR.
  • [For Experimental Features] Documentation to be submitted in a separate PR.

PR Checklist

  • I have tested the changes locally.
  • I have formatted the changes with Prettier and/or cargo fmt on default settings.

@asterite asterite changed the title Ab/test attribute improvements feat: improve test attribute errors Oct 30, 2024
@asterite asterite changed the title feat: improve test attribute errors feat: improve malformed test attribute error Oct 30, 2024
@jfecher jfecher added this pull request to the merge queue Oct 30, 2024
Merged via the queue into master with commit 8f516d7 Oct 30, 2024
47 checks passed
@jfecher jfecher deleted the ab/test-attribute-improvements branch October 30, 2024 20:58
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Oct 31, 2024
…ng/noir#6396)

feat: improve malformed test attribute error (noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens (noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd (noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish (noir-lang/noir#6404)
fix: numeric generic doesn't have a default type (noir-lang/noir#6405)
feat: Sync from aztec-packages (noir-lang/noir#6403)
chore: add regression tests for #4372 (noir-lang/noir#6401)
chore: add regression tests for #6314 (noir-lang/noir#6381)
@asterite asterite mentioned this pull request Oct 31, 2024
5 tasks
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 1, 2024
…oir-lang/noir#6416)

chore: create a regression test for #6420 (noir-lang/noir#6421)
chore: Release Noir(0.37.0) (noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct (noir-lang/noir#6419)
feat!: remove mimc from stdlib (noir-lang/noir#6402)
chore: Replace dead link with updated route in README (noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed (noir-lang/noir#6396)
feat: improve malformed test attribute error (noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens (noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd (noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish (noir-lang/noir#6404)
fix: numeric generic doesn't have a default type (noir-lang/noir#6405)
feat: Sync from aztec-packages (noir-lang/noir#6403)
chore: add regression tests for #4372 (noir-lang/noir#6401)
chore: add regression tests for #6314 (noir-lang/noir#6381)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 1, 2024
…ir#6416)

chore: create a regression test for #6420 (noir-lang/noir#6421)
chore: Release Noir(0.37.0) (noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct (noir-lang/noir#6419)
feat!: remove mimc from stdlib (noir-lang/noir#6402)
chore: Replace dead link with updated route in README (noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed (noir-lang/noir#6396)
feat: improve malformed test attribute error (noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens (noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd (noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish (noir-lang/noir#6404)
fix: numeric generic doesn't have a default type (noir-lang/noir#6405)
feat: Sync from aztec-packages (noir-lang/noir#6403)
chore: add regression tests for #4372 (noir-lang/noir#6401)
chore: add regression tests for #6314 (noir-lang/noir#6381)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 1, 2024
…oir#6415)

fix: fix Alias and Error kinds (noir-lang/noir#6426)
fix: type-check turbofish in trait before function call (noir-lang/noir#6416)
chore: create a regression test for #6420 (noir-lang/noir#6421)
chore: Release Noir(0.37.0) (noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct (noir-lang/noir#6419)
feat!: remove mimc from stdlib (noir-lang/noir#6402)
chore: Replace dead link with updated route in README (noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed (noir-lang/noir#6396)
feat: improve malformed test attribute error (noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens (noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd (noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish (noir-lang/noir#6404)
fix: numeric generic doesn't have a default type (noir-lang/noir#6405)
feat: Sync from aztec-packages (noir-lang/noir#6403)
chore: add regression tests for #4372 (noir-lang/noir#6401)
chore: add regression tests for #6314 (noir-lang/noir#6381)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 1, 2024
fix: fix Alias and Error kinds (noir-lang/noir#6426)
fix: type-check turbofish in trait before function call (noir-lang/noir#6416)
chore: create a regression test for #6420 (noir-lang/noir#6421)
chore: Release Noir(0.37.0) (noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct (noir-lang/noir#6419)
feat!: remove mimc from stdlib (noir-lang/noir#6402)
chore: Replace dead link with updated route in README (noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed (noir-lang/noir#6396)
feat: improve malformed test attribute error (noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens (noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd (noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish (noir-lang/noir#6404)
fix: numeric generic doesn't have a default type (noir-lang/noir#6405)
feat: Sync from aztec-packages (noir-lang/noir#6403)
chore: add regression tests for #4372 (noir-lang/noir#6401)
chore: add regression tests for #6314 (noir-lang/noir#6381)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 2, 2024
…ang/noir#6413)

feat: ensure that generated ACIR is solvable (noir-lang/noir#6415)
fix: fix Alias and Error kinds (noir-lang/noir#6426)
fix: type-check turbofish in trait before function call (noir-lang/noir#6416)
chore: create a regression test for #6420 (noir-lang/noir#6421)
chore: Release Noir(0.37.0) (noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct (noir-lang/noir#6419)
feat!: remove mimc from stdlib (noir-lang/noir#6402)
chore: Replace dead link with updated route in README (noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed (noir-lang/noir#6396)
feat: improve malformed test attribute error (noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens (noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd (noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish (noir-lang/noir#6404)
fix: numeric generic doesn't have a default type (noir-lang/noir#6405)
feat: Sync from aztec-packages (noir-lang/noir#6403)
chore: add regression tests for #4372 (noir-lang/noir#6401)
chore: add regression tests for #6314 (noir-lang/noir#6381)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 2, 2024
feat: ensure that generated ACIR is solvable (noir-lang/noir#6415)
fix: fix Alias and Error kinds (noir-lang/noir#6426)
fix: type-check turbofish in trait before function call (noir-lang/noir#6416)
chore: create a regression test for #6420 (noir-lang/noir#6421)
chore: Release Noir(0.37.0) (noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct (noir-lang/noir#6419)
feat!: remove mimc from stdlib (noir-lang/noir#6402)
chore: Replace dead link with updated route in README (noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed (noir-lang/noir#6396)
feat: improve malformed test attribute error (noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens (noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd (noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish (noir-lang/noir#6404)
fix: numeric generic doesn't have a default type (noir-lang/noir#6405)
feat: Sync from aztec-packages (noir-lang/noir#6403)
chore: add regression tests for #4372 (noir-lang/noir#6401)
chore: add regression tests for #6314 (noir-lang/noir#6381)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 3, 2024
…ang/noir#6413)

feat: ensure that generated ACIR is solvable (noir-lang/noir#6415)
fix: fix Alias and Error kinds (noir-lang/noir#6426)
fix: type-check turbofish in trait before function call (noir-lang/noir#6416)
chore: create a regression test for #6420 (noir-lang/noir#6421)
chore: Release Noir(0.37.0) (noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct (noir-lang/noir#6419)
feat!: remove mimc from stdlib (noir-lang/noir#6402)
chore: Replace dead link with updated route in README (noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed (noir-lang/noir#6396)
feat: improve malformed test attribute error (noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens (noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd (noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish (noir-lang/noir#6404)
fix: numeric generic doesn't have a default type (noir-lang/noir#6405)
feat: Sync from aztec-packages (noir-lang/noir#6403)
chore: add regression tests for #4372 (noir-lang/noir#6401)
chore: add regression tests for #6314 (noir-lang/noir#6381)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 3, 2024
feat: ensure that generated ACIR is solvable (noir-lang/noir#6415)
fix: fix Alias and Error kinds (noir-lang/noir#6426)
fix: type-check turbofish in trait before function call (noir-lang/noir#6416)
chore: create a regression test for #6420 (noir-lang/noir#6421)
chore: Release Noir(0.37.0) (noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct (noir-lang/noir#6419)
feat!: remove mimc from stdlib (noir-lang/noir#6402)
chore: Replace dead link with updated route in README (noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed (noir-lang/noir#6396)
feat: improve malformed test attribute error (noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens (noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd (noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish (noir-lang/noir#6404)
fix: numeric generic doesn't have a default type (noir-lang/noir#6405)
feat: Sync from aztec-packages (noir-lang/noir#6403)
chore: add regression tests for #4372 (noir-lang/noir#6401)
chore: add regression tests for #6314 (noir-lang/noir#6381)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 4, 2024
…ang/noir#6413)

feat: ensure that generated ACIR is solvable (noir-lang/noir#6415)
fix: fix Alias and Error kinds (noir-lang/noir#6426)
fix: type-check turbofish in trait before function call (noir-lang/noir#6416)
chore: create a regression test for #6420 (noir-lang/noir#6421)
chore: Release Noir(0.37.0) (noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct (noir-lang/noir#6419)
feat!: remove mimc from stdlib (noir-lang/noir#6402)
chore: Replace dead link with updated route in README (noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed (noir-lang/noir#6396)
feat: improve malformed test attribute error (noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens (noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd (noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish (noir-lang/noir#6404)
fix: numeric generic doesn't have a default type (noir-lang/noir#6405)
feat: Sync from aztec-packages (noir-lang/noir#6403)
chore: add regression tests for #4372 (noir-lang/noir#6401)
chore: add regression tests for #6314 (noir-lang/noir#6381)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 4, 2024
feat: ensure that generated ACIR is solvable (noir-lang/noir#6415)
fix: fix Alias and Error kinds (noir-lang/noir#6426)
fix: type-check turbofish in trait before function call (noir-lang/noir#6416)
chore: create a regression test for #6420 (noir-lang/noir#6421)
chore: Release Noir(0.37.0) (noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct (noir-lang/noir#6419)
feat!: remove mimc from stdlib (noir-lang/noir#6402)
chore: Replace dead link with updated route in README (noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed (noir-lang/noir#6396)
feat: improve malformed test attribute error (noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens (noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd (noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish (noir-lang/noir#6404)
fix: numeric generic doesn't have a default type (noir-lang/noir#6405)
feat: Sync from aztec-packages (noir-lang/noir#6403)
chore: add regression tests for #4372 (noir-lang/noir#6401)
chore: add regression tests for #6314 (noir-lang/noir#6381)
AztecBot added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 4, 2024
…ang/noir#6413)

feat: ensure that generated ACIR is solvable (noir-lang/noir#6415)
fix: fix Alias and Error kinds (noir-lang/noir#6426)
fix: type-check turbofish in trait before function call (noir-lang/noir#6416)
chore: create a regression test for #6420 (noir-lang/noir#6421)
chore: Release Noir(0.37.0) (noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct (noir-lang/noir#6419)
feat!: remove mimc from stdlib (noir-lang/noir#6402)
chore: Replace dead link with updated route in README (noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed (noir-lang/noir#6396)
feat: improve malformed test attribute error (noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens (noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd (noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish (noir-lang/noir#6404)
fix: numeric generic doesn't have a default type (noir-lang/noir#6405)
feat: Sync from aztec-packages (noir-lang/noir#6403)
chore: add regression tests for #4372 (noir-lang/noir#6401)
chore: add regression tests for #6314 (noir-lang/noir#6381)
TomAFrench added a commit to AztecProtocol/aztec-packages that referenced this pull request Nov 4, 2024
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
feat: nargo command to generate shell completions
(noir-lang/noir#6413)
feat: ensure that generated ACIR is solvable
(noir-lang/noir#6415)
fix: fix Alias and Error kinds
(noir-lang/noir#6426)
fix: type-check turbofish in trait before function call
(noir-lang/noir#6416)
chore: create a regression test for #6420
(noir-lang/noir#6421)
chore: Release Noir(0.37.0)
(noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct
(noir-lang/noir#6419)
feat!: remove mimc from stdlib
(noir-lang/noir#6402)
chore: Replace dead link with updated route in README
(noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed
(noir-lang/noir#6396)
feat: improve malformed test attribute error
(noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more
informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens
(noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd
(noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish
(noir-lang/noir#6404)
fix: numeric generic doesn't have a default type
(noir-lang/noir#6405)
feat: Sync from aztec-packages
(noir-lang/noir#6403)
chore: add regression tests for #4372
(noir-lang/noir#6401)
chore: add regression tests for #6314
(noir-lang/noir#6381)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Tom French <[email protected]>
Co-authored-by: Tom French <[email protected]>
AztecBot added a commit to AztecProtocol/aztec-nr that referenced this pull request Nov 5, 2024
Automated pull of development from the
[noir](https://github.com/noir-lang/noir) programming language, a
dependency of Aztec.
BEGIN_COMMIT_OVERRIDE
feat: nargo command to generate shell completions
(noir-lang/noir#6413)
feat: ensure that generated ACIR is solvable
(noir-lang/noir#6415)
fix: fix Alias and Error kinds
(noir-lang/noir#6426)
fix: type-check turbofish in trait before function call
(noir-lang/noir#6416)
chore: create a regression test for #6420
(noir-lang/noir#6421)
chore: Release Noir(0.37.0)
(noir-lang/noir#6321)
chore: update variable names in stdlib tests to be more correct
(noir-lang/noir#6419)
feat!: remove mimc from stdlib
(noir-lang/noir#6402)
chore: Replace dead link with updated route in README
(noir-lang/noir#6392)
feat(ci): Add report of Brillig opcodes executed
(noir-lang/noir#6396)
feat: improve malformed test attribute error
(noir-lang/noir#6414)
fix: aliases in path (noir-lang/noir#6399)
feat(profiler): Add Brillig procedure info to debug artifact for more
informative profiling (noir-lang/noir#6385)
chore(lsp): Remove profile code lens
(noir-lang/noir#6411)
chore(nargo): Remove old profile as part of info cmd
(noir-lang/noir#6406)
fix: distinguish TypePath with and without turbofish
(noir-lang/noir#6404)
fix: numeric generic doesn't have a default type
(noir-lang/noir#6405)
feat: Sync from aztec-packages
(noir-lang/noir#6403)
chore: add regression tests for #4372
(noir-lang/noir#6401)
chore: add regression tests for #6314
(noir-lang/noir#6381)
END_COMMIT_OVERRIDE

---------

Co-authored-by: Tom French <[email protected]>
Co-authored-by: Tom French <[email protected]>
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.

Noir ignores a test when test header is malformed
2 participants