Skip to content

Commit

Permalink
Run recursively move tests under examples/ (MystenLabs#17600)
Browse files Browse the repository at this point in the history
- Run recursively move tests under examples/
- Update tests

## Description 

Describe the changes or additions included in this PR.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
  • Loading branch information
benr-ml authored May 9, 2024
1 parent 5a64ec8 commit 8e252a0
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
25 changes: 16 additions & 9 deletions crates/sui-framework-tests/src/unit_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn run_deepbook_tests() {

#[test]
#[cfg_attr(msim, ignore)]
fn run_examples_move_unit_tests() {
fn run_sui_programmability_examples_move_unit_tests() {
for example in [
"basics",
"capy",
Expand All @@ -65,22 +65,29 @@ fn run_examples_move_unit_tests() {
}
}

fn check_packages_recursively(path: &PathBuf) -> io::Result<()> {
for entry in fs::read_dir(path).unwrap() {
let entry = entry?;
if entry.path().join("Move.toml").exists() {
check_package_builds(entry.path());
check_move_unit_tests(entry.path());
} else if entry.file_type()?.is_dir() {
check_packages_recursively(&entry.path())?;
}
}
Ok(())
}

#[test]
#[cfg_attr(msim, ignore)]
fn run_docs_examples_move_unit_tests() -> io::Result<()> {
fn run_examples_move_unit_tests() -> io::Result<()> {
let examples = {
let mut buf = PathBuf::from(env!("CARGO_MANIFEST_DIR"));
buf.extend(["..", "..", "examples", "move"]);
buf
};

for entry in fs::read_dir(examples)? {
let entry = entry?;
if entry.file_type()?.is_dir() && entry.path().join("Move.toml").exists() {
check_package_builds(entry.path());
check_move_unit_tests(entry.path());
}
}
check_packages_recursively(&examples)?;

Ok(())
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
module common::identified_payment {
use sui::sui::SUI;
use sui::coin::{Self, Coin};
use sui::object::{Self, UID};
use sui::transfer::{Self, Receiving};
use sui::tx_context::{Self, TxContext};
use sui::transfer::Receiving;
use sui::event;
use sui::dynamic_field;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@ module shared_with_tto::shared_cash_register {
use common::identified_payment::{Self, IdentifiedPayment, EarmarkedPayment};
use sui::sui::SUI;
use sui::coin::Coin;
use sui::object::{Self, UID};
use sui::transfer::{Self, Receiving};
use sui::tx_context::{Self, TxContext};
use sui::transfer::Receiving;
use sui::vec_set::{Self, VecSet};
use std::vector;
use std::string::String;

const EInvalidOwner: u64 = 0;
Expand Down

0 comments on commit 8e252a0

Please sign in to comment.