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

[CLI] Adds initial package layout on sui move new #16255

Merged
merged 3 commits into from
Mar 17, 2024
Merged

Conversation

damirka
Copy link
Contributor

@damirka damirka commented Feb 15, 2024

Description

Following the discussion on scaffolding the app:

  • adds sources/{name}.move
  • adds tests/{name}_tests.move
sources/
    donuts.move
tests/
    donuts_tests.move
Move.toml

File: sources/name.move; Commented out contents:

/// Module: donuts
module donuts::donuts {

}

File: tests/name_tests.move; Commented out contents:

#[test_only]
module donuts::donuts_tests {
    // uncomment this line to import the module
    // use donuts::donuts;

    const ENotImplemented: u64 = 0;

    #[test]
    fun test_donuts() {
        // pass
    }

    #[test, expected_failure(abort_code = donuts::donuts_tests::ENotImplemented)]
    fun test_donuts_fail() {
        abort ENotImplemented
    }
}

Test Plan

Tests pass!

Type of Change (Check all that apply)

  • protocol change
  • user-visible impact
  • breaking change for a client SDKs
  • breaking change for FNs (FN binary must upgrade)
  • breaking change for validators or node operators (must upgrade binaries)
  • breaking change for on-chain data layout
  • necessitate either a data wipe or data migration

Release notes

@damirka damirka self-assigned this Feb 15, 2024
Copy link

vercel bot commented Feb 15, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-core ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 15, 2024 11:37am
sui-typescript-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 15, 2024 11:37am
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
explorer ⬜️ Ignored (Inspect) Visit Preview Feb 15, 2024 11:37am
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Feb 15, 2024 11:37am
mysten-ui ⬜️ Ignored (Inspect) Visit Preview Feb 15, 2024 11:37am
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Feb 15, 2024 11:37am

@damirka damirka changed the title [CLI] Adds initial layout for sui move new [CLI] Adds initial package layout on sui move new Feb 15, 2024
@damirka damirka requested a review from tzakian February 15, 2024 10:57
Copy link
Member

@stefan-mysten stefan-mysten left a comment

Choose a reason for hiding this comment

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

Without knowing the context of the discussion, this looks fine to me. Not sure if it is what an user would expect (and this is where this kind of thing will get you different opinions, some want X, others want Y, etc), but if this is what's needed to start a quick project and have some template ready, it's fine.

@josemvcerqueira
Copy link
Contributor

Awesome, do you think it would be helpful to add a comment line on top of the test file saying something along the lines of:

Learn more about testing at https://docs.sui.io/guides/developer/first-app/build-test

@damirka
Copy link
Contributor Author

damirka commented Mar 8, 2024

Without knowing the context of the discussion, this looks fine to me. Not sure if it is what an user would expect (and this is where this kind of thing will get you different opinions, some want X, others want Y, etc), but if this is what's needed to start a quick project and have some template ready, it's fine.

As someone who starts a new package often, I get annoyed by the need to add the source file. Received similar feedback from other folks on the team and community members.

As to the testing file, we do have an example of it in the Move by Example book but I think we're slowly going to the setup where developer has all things at hand with no need to look them up. Just like we recently added a richer Move.toml descriptions - #16191

@stefan-mysten

Copy link
Member

@stefan-mysten stefan-mysten left a comment

Choose a reason for hiding this comment

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

LGTM

@damirka damirka merged commit 1cedbb8 into main Mar 17, 2024
41 checks passed
@damirka damirka deleted the ds/sui-move-new branch March 17, 2024 09:05
tx-tomcat pushed a commit to tx-tomcat/sui-network that referenced this pull request May 30, 2024
## Description 

Following the discussion on scaffolding the app:

- adds `sources/{name}.move`
- adds `tests/{name}_tests.move`

```sh
sources/
    donuts.move
tests/
    donuts_tests.move
Move.toml
```

File: sources/name.move; Commented out contents:
```move
/// Module: donuts
module donuts::donuts {

}
```

File: tests/name_tests.move; Commented out contents:
```move
#[test_only]
module donuts::donuts_tests {
    // uncomment this line to import the module
    // use donuts::donuts;

    const ENotImplemented: u64 = 0;

    #[test]
    fun test_donuts() {
        // pass
    }

    #[test, expected_failure(abort_code = donuts::donuts_tests::ENotImplemented)]
    fun test_donuts_fail() {
        abort ENotImplemented
    }
}
```

## Test Plan 

Tests pass!

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes
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