1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
use clap::{Parser, Subcommand};
#[derive(Subcommand, Debug)]
pub enum AddCommand {
/// Add canister
Canister {
/// Canister name
name: String,
/// Path to .wasm or .wasm.gz file
#[arg(long)]
wasm: Option<String>,
/// Path to a candid value file for canister initialization
#[arg(long)]
init_arg_file: Option<String>,
/// A candid value file for canister initialization
#[arg(long)]
init_arg: Option<String>,
},
/// Add contract
Contract {
/// Contract name
name: String,
/// Path to the solidity .json file
#[arg(long)]
sol_json: Option<String>,
},
}
#[derive(Subcommand, Debug)]
pub enum Command {
/// Initialize a new test project
New {
#[arg(default_value_t = String::from("tests"))]
test_folder: String,
/// Enforce generating over the uncommitted git changes
#[arg(long, default_value = "false")]
force: bool,
},
/// Update the existing test project
Update {
/// Canister or contract name
name: Option<String>,
/// Path to .wasm or .wasm.gz file
#[arg(long)]
wasm: Option<String>,
/// Path to a candid value file for canister initialization
#[arg(long)]
init_arg_file: Option<String>,
/// A candid value file for canister initialization
#[arg(long)]
init_arg: Option<String>,
/// Path to the solidity .json file
#[arg(long)]
sol_json: Option<String>,
/// Enforce overwriting the test_setup.rs file and enforce writing over the uncommitted git changes
#[arg(long, default_value = "false")]
force: bool,
},
/// Add a canister or a contract
Add {
/// Choose what you want to add
#[command(subcommand)]
command: AddCommand,
},
}
#[derive(Parser, Debug)]
#[command(version, about=format!("IC Test framework V{}", env!("CARGO_PKG_VERSION")), long_about = None)]
pub struct IcpTestArgs {
/// Choose which action you want to perform
#[command(subcommand)]
pub command: Command,
/// Path to ic-test.json file
#[arg(long, default_value_t = String::from("ic-test.json"))]
pub ic_test_json: String,
/// Path to dfx.json, where to gather information on existing canisters
#[arg(long)]
pub dfx_json: Option<String>,
/// Do not use dfx.json to gather information on the available canisters
#[arg(long)]
pub skip_dfx_json: Option<bool>,
/// Use interactive mode
#[arg(long)]
pub ui: Option<bool>,
/// Root project directory, where to run the tool
#[arg(long)]
pub root: Option<String>,
/// Do not use foundry.toml to gather information on the available contracts
#[arg(long)]
pub skip_foundry_toml: Option<bool>,
}