Skip to content

Commit 81c0517

Browse files
committed
Reorganize testsvm-assertions
1 parent b25aedb commit 81c0517

File tree

11 files changed

+49
-96
lines changed

11 files changed

+49
-96
lines changed

Cargo.lock

Lines changed: 17 additions & 23 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/testsvm-assertions/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ testsvm-core = { version = "0.1.1", path = "../testsvm-core" }
2424
anyhow = "1.0"
2525
litesvm = "0.6.1"
2626
solana-sdk = "2.2.1"
27+
28+
[dev-dependencies]
29+
testsvm-spl = { version = "0.1.0", path = "../testsvm-spl" }
30+
anchor-spl = { version = "0.31.1", features = ["token"] }

crates/testsvm-assertions/src/lib.rs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
use anyhow::*;
1717
use litesvm::types::TransactionMetadata;
1818
use solana_sdk::instruction::InstructionError;
19-
20-
use testsvm_core::{TXError, TXResult};
19+
use testsvm_core::prelude::*;
2120

2221
/// Provides assertion methods for failed transactions.
2322
///
@@ -172,7 +171,9 @@ pub trait TXResultAssertions {
172171
/// # Example
173172
///
174173
/// ```rust
175-
/// # use testsvm::{TestSVM, TXResultAssertions, TestSVMSPLHelpers};
174+
/// # use testsvm_core::prelude::*;
175+
/// # use testsvm_spl::prelude::*;
176+
/// # use testsvm_assertions::*;
176177
/// # use solana_sdk::signature::Signer;
177178
/// # use anyhow::Result;
178179
/// # fn main() -> Result<()> {
@@ -222,7 +223,9 @@ pub trait TXResultAssertions {
222223
/// # Example
223224
///
224225
/// ```rust
225-
/// # use testsvm::{TestSVM, TXResultAssertions, TestSVMSPLHelpers};
226+
/// # use testsvm_core::prelude::*;
227+
/// # use testsvm_spl::prelude::*;
228+
/// # use testsvm_assertions::*;
226229
/// # use solana_sdk::signature::Signer;
227230
/// # use anyhow::Result;
228231
/// # fn main() -> Result<()> {

crates/testsvm-core/src/prelude.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,12 @@ pub use crate::{AccountRef, TXError, TXResult, TestSVM};
1010
pub use solana_address_book::{AddressBook, AddressRole, RegisteredAddress};
1111

1212
// Commonly used Anchor types
13-
pub use anchor_lang::{InstructionData, prelude::*};
13+
pub use anchor_lang::{
14+
AccountDeserialize, AccountSerialize, Discriminator, InstructionData, Key, ToAccountInfos,
15+
ToAccountMetas,
16+
};
17+
18+
pub use anyhow::Result;
1419

1520
// Commonly used Solana SDK types
1621
pub use solana_sdk::{

crates/testsvm-quarry/src/test_rewarder.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515
//! - **Authority Control**: Manage rewarder authority and pause states
1616
1717
use crate::{TestMintWrapper, quarry_mine, quarry_mint_wrapper};
18-
use anchor_lang::prelude::*;
19-
use anyhow::Result;
20-
use solana_sdk::signature::{Keypair, Signer};
21-
use testsvm::TXResult;
2218
use testsvm::prelude::*;
2319

2420
/// Test rewarder with labeled accounts

crates/testsvm-spl/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//! and performing token operations.
88
99
use anchor_spl::token;
10-
use anyhow::{anyhow, Context, Result};
10+
use anyhow::{Context, Result, anyhow};
1111
use testsvm_core::prelude::*;
1212

1313
pub mod prelude;

crates/testsvm-spl/src/prelude.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,4 @@
1212
//! This will import everything from testsvm-core plus:
1313
//! - `TestSVMSPLHelpers` - SPL Token helper trait
1414
15-
// Re-export testsvm-core prelude
16-
pub use testsvm_core::prelude::*;
17-
18-
// SPL-specific exports
19-
pub use crate::TestSVMSPLHelpers;
15+
pub use crate::TestSVMSPLHelpers;

crates/testsvm/src/lib.rs

Lines changed: 9 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@
1717
//! ## Quick Start
1818
//!
1919
//! ```rust,no_run
20-
//! use testsvm::TestSVM;
21-
//! use solana_sdk::pubkey::Pubkey;
22-
//! use solana_sdk::transaction::Transaction;
23-
//! use solana_sdk::signature::Signer;
24-
//! # use anyhow::Result;
20+
//! use testsvm::prelude::*;
2521
//! # fn main() -> Result<()> {
2622
//!
2723
//! // Create a new test environment
@@ -56,7 +52,7 @@
5652
//! ## Working with Programs
5753
//!
5854
//! ```rust,no_run
59-
//! use testsvm::TestSVM;
55+
//! use testsvm::prelude::*;
6056
//! use solana_sdk::pubkey::Pubkey;
6157
//! # use anyhow::Result;
6258
//! # fn main() -> Result<()> {
@@ -81,9 +77,7 @@
8177
//! ## Account Management
8278
//!
8379
//! ```rust
84-
//! use testsvm::{TestSVM, AccountRef, TestSVMSPLHelpers};
85-
//! use solana_sdk::signature::Signer;
86-
//! # use anyhow::Result;
80+
//! use testsvm::prelude::*;
8781
//! # fn main() -> Result<()> {
8882
//!
8983
//! let mut env = TestSVM::init()?;
@@ -108,10 +102,7 @@
108102
//! ## Transaction Building and Execution
109103
//!
110104
//! ```rust
111-
//! use testsvm::{TestSVM, TXResultAssertions};
112-
//! use solana_sdk::transaction::Transaction;
113-
//! use solana_sdk::signature::Signer;
114-
//! # use anyhow::Result;
105+
//! use testsvm::prelude::*;
115106
//! # fn main() -> Result<()> {
116107
//!
117108
//! let mut env = TestSVM::init()?;
@@ -142,9 +133,7 @@
142133
//! ## Debugging and Analysis
143134
//!
144135
//! ```rust
145-
//! use testsvm::TestSVM;
146-
//! use solana_sdk::transaction::Transaction;
147-
//! # use anyhow::Result;
136+
//! use testsvm::prelude::*;
148137
//! # fn main() -> Result<()> {
149138
//!
150139
//! let mut env = TestSVM::init()?;
@@ -178,15 +167,10 @@
178167
//! ## Integration with Anchor
179168
//!
180169
//! ```rust,no_run
181-
//! use testsvm::{TestSVM, TXResultAssertions};
182-
//! use anchor_lang::prelude::*;
183-
//! use testsvm::anchor_instruction;
184-
//! # use anyhow::Result;
170+
//! use testsvm::prelude::*;
185171
//!
186172
//! // Example program module (would be generated by Anchor)
187173
//! // declare_program!(my_program) would generate something similar to:
188-
//! # use anchor_lang::prelude::*;
189-
//! # use solana_sdk::pubkey::Pubkey;
190174
//! # pub mod my_program {
191175
//! # use solana_sdk::pubkey::Pubkey;
192176
//! # pub const ID: Pubkey = Pubkey::new_from_array([0; 32]);
@@ -237,6 +221,6 @@ pub mod prelude;
237221
// Re-export from other crates
238222
pub use ::anchor_utils::*;
239223
pub use ::solana_address_book::*;
240-
pub use testsvm_assertions::*;
241-
pub use testsvm_core::*;
242-
pub use testsvm_spl::*;
224+
pub use testsvm_assertions;
225+
pub use testsvm_core;
226+
pub use testsvm_spl;

crates/testsvm/src/prelude.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@
1010
//! ```
1111
1212
// Core TestSVM types
13-
pub use crate::{
14-
AccountRef, TXError, TXErrorAssertions, TXResult, TXResultAssertions, TXSuccessAssertions,
15-
TestSVM,
16-
};
17-
18-
pub use crate::TestSVMSPLHelpers;
1913
pub use anchor_spl;
14+
pub use testsvm_assertions::{TXErrorAssertions, TXResultAssertions, TXSuccessAssertions};
2015
pub use testsvm_core::prelude::*;
16+
pub use testsvm_spl::prelude::*;

devenv.lock

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
"devenv": {
44
"locked": {
55
"dir": "src/modules",
6-
"lastModified": 1756101922,
6+
"lastModified": 1756415044,
77
"owner": "cachix",
88
"repo": "devenv",
9-
"rev": "372c975fd0d5b7fc1ffbb15c75a21d7f9ea97603",
9+
"rev": "c570189b38b549141179647da3ddde249ac50fec",
1010
"type": "github"
1111
},
1212
"original": {
@@ -94,27 +94,7 @@
9494
"nixpkgs": "nixpkgs",
9595
"pre-commit-hooks": [
9696
"git-hooks"
97-
],
98-
"rust-overlay": "rust-overlay"
99-
}
100-
},
101-
"rust-overlay": {
102-
"inputs": {
103-
"nixpkgs": [
104-
"nixpkgs"
10597
]
106-
},
107-
"locked": {
108-
"lastModified": 1756348497,
109-
"owner": "oxalica",
110-
"repo": "rust-overlay",
111-
"rev": "0adf92c70d23fb4f703aea5d3ebb51ac65994f7f",
112-
"type": "github"
113-
},
114-
"original": {
115-
"owner": "oxalica",
116-
"repo": "rust-overlay",
117-
"type": "github"
11898
}
11999
}
120100
},

0 commit comments

Comments
 (0)