Skip to content

REFACTOR: move run-tests and fix the std assert namespace#9303

Merged
fdncred merged 4 commits intonushell:mainfrom
amtoine:refactor/std-assert
May 27, 2023
Merged

REFACTOR: move run-tests and fix the std assert namespace#9303
fdncred merged 4 commits intonushell:mainfrom
amtoine:refactor/std-assert

Conversation

@amtoine
Copy link
Copy Markdown
Member

@amtoine amtoine commented May 27, 2023

related to the namespace bullet point in

Description

this was the last module of the standard library with a broken namespace, this PR takes care of this.

  • run-tests has been moved to std/mod.nu
  • std/testing.nu has been moved to std/assert.nu
  • the namespace has been fixed
    • assert is now called main and used in all the other std assert commands
    • for std assert length and std assert str contains, in order not to shadow the built-in length and str contains commands, i've used alias "core ..." = ... to (1) define foo in assert.nu and (2) still use the builtin foo with core foo (replace foo by length or str contains)
    • tests have been fixed accordingly

User-Facing Changes

one can not use

use std "assert equal"

anymore because assert ... is not exported from std.
std assert is now a real module.

Tests + Formatting

  • 🟢 toolkit fmt
  • 🟢 toolkit clippy
  • toolkit test
  • toolkit test stdlib

After Submitting

$nothing

Notes for reviewers

to test this, i think the easiest is to

  • run toolkit test stdlib and see all the tests pass
  • run cargo run -- -n and try use std assert => are all the commands available in scope?

amtoine added 4 commits May 27, 2023 10:45
- rename `assert` into `main`
- remove the `assert` in front of all the commands
- use `alias "core foo" = foo` to avoid shadowing them completely
@amtoine amtoine added notes:breaking-changes This PR implies a change affecting users and has to be noted in the release notes A:std-library Defining and improving the standard library written in Nu labels May 27, 2023
@amtoine amtoine mentioned this pull request May 27, 2023
7 tasks
@fdncred fdncred merged commit 3005fe1 into nushell:main May 27, 2023
@fdncred
Copy link
Copy Markdown
Contributor

fdncred commented May 27, 2023

👍🏻

@amtoine amtoine deleted the refactor/std-assert branch May 28, 2023 07:15
amtoine added a commit to amtoine/nu-git-manager that referenced this pull request May 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A:std-library Defining and improving the standard library written in Nu notes:breaking-changes This PR implies a change affecting users and has to be noted in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants