Skip to content

Commit 9274be5

Browse files
committed
[wip]: Add tests
1 parent bcb1123 commit 9274be5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+3489
-0
lines changed

packages/renderers-pinocchio/e2e/dummy/Cargo.lock

Lines changed: 49 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[package]
2+
name = "codama-renderers-rust-e2e-dummy"
3+
version = "0.0.0"
4+
edition = "2021"
5+
6+
[features]
7+
test-sbf = []
8+
9+
[dependencies]
10+
pinocchio = "0.6"
11+
pinocchio-pubkey = "0.2"
12+
13+
[dev-dependencies]
14+
assert_matches = "1.5.0"
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
{
2+
"kind": "rootNode",
3+
"program": {
4+
"kind": "programNode",
5+
"pdas": [],
6+
"accounts": [],
7+
"instructions": [
8+
{
9+
"kind": "instructionNode",
10+
"name": "instruction1",
11+
"optionalAccountStrategy": "programId",
12+
"docs": ["Testing instructions with no accounts or arguments"],
13+
"accounts": [],
14+
"arguments": [],
15+
"remainingAccounts": []
16+
},
17+
{
18+
"kind": "instructionNode",
19+
"name": "instruction2",
20+
"optionalAccountStrategy": "programId",
21+
"docs": ["Testing instructions with remaining accounts only"],
22+
"accounts": [],
23+
"arguments": [],
24+
"remainingAccounts": [
25+
{
26+
"kind": "instructionRemainingAccountsNode",
27+
"value": {
28+
"kind": "argumentValueNode",
29+
"name": "remainingAccounts"
30+
},
31+
"isOptional": true,
32+
"isSigner": false
33+
}
34+
]
35+
},
36+
{
37+
"kind": "instructionNode",
38+
"name": "instruction3",
39+
"optionalAccountStrategy": "programId",
40+
"docs": ["Testing instructions with discriminator only"],
41+
"accounts": [],
42+
"arguments": [
43+
{
44+
"kind": "instructionArgumentNode",
45+
"name": "discriminator",
46+
"type": {
47+
"kind": "numberTypeNode",
48+
"format": "u32",
49+
"endian": "le"
50+
},
51+
"docs": [],
52+
"defaultValue": { "kind": "numberValueNode", "number": 42 },
53+
"defaultValueStrategy": "omitted"
54+
}
55+
],
56+
"discriminators": [
57+
{
58+
"kind": "fieldDiscriminatorNode",
59+
"name": "discriminator",
60+
"offset": 0
61+
}
62+
]
63+
},
64+
{
65+
"kind": "instructionNode",
66+
"name": "instruction4",
67+
"optionalAccountStrategy": "programId",
68+
"docs": ["Testing instructions with arguments only"],
69+
"accounts": [],
70+
"arguments": [
71+
{
72+
"kind": "instructionArgumentNode",
73+
"name": "myArgument",
74+
"type": {
75+
"kind": "numberTypeNode",
76+
"format": "u64",
77+
"endian": "le"
78+
},
79+
"docs": []
80+
}
81+
]
82+
},
83+
{
84+
"kind": "instructionNode",
85+
"name": "instruction5",
86+
"optionalAccountStrategy": "programId",
87+
"docs": ["Testing instructions with optional arguments only"],
88+
"accounts": [],
89+
"arguments": [
90+
{
91+
"kind": "instructionArgumentNode",
92+
"name": "myArgument",
93+
"type": {
94+
"kind": "numberTypeNode",
95+
"format": "u64",
96+
"endian": "le"
97+
},
98+
"defaultValue": { "kind": "numberValueNode", "number": 42 },
99+
"docs": []
100+
}
101+
]
102+
},
103+
{
104+
"kind": "instructionNode",
105+
"name": "instruction6",
106+
"optionalAccountStrategy": "programId",
107+
"docs": ["Testing instructions with accounts only"],
108+
"accounts": [
109+
{
110+
"kind": "instructionAccountNode",
111+
"name": "myAccount",
112+
"isWritable": true,
113+
"isSigner": false,
114+
"isOptional": false,
115+
"docs": []
116+
}
117+
],
118+
"arguments": []
119+
},
120+
{
121+
"kind": "instructionNode",
122+
"name": "instruction7",
123+
"optionalAccountStrategy": "programId",
124+
"docs": ["Testing instructions with optional accounts only"],
125+
"accounts": [
126+
{
127+
"kind": "instructionAccountNode",
128+
"name": "myAccount",
129+
"isWritable": true,
130+
"isSigner": false,
131+
"isOptional": true,
132+
"docs": []
133+
}
134+
],
135+
"arguments": []
136+
}
137+
],
138+
"definedTypes": [],
139+
"errors": [],
140+
"name": "dummy",
141+
"prefix": "",
142+
"publicKey": "Dummy11111111111111111111111111111111111111",
143+
"version": "3.0.1",
144+
"origin": "shank"
145+
},
146+
"additionalPrograms": [],
147+
"standard": "codama",
148+
"version": "1.0.0"
149+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//! This code was AUTOGENERATED using the codama library.
2+
//! Please DO NOT EDIT THIS FILE, instead use visitors
3+
//! to add features, then rerun codama to update it.
4+
//!
5+
//! <https://github.com/codama-idl/codama>
6+
//!
7+
8+
/// `instruction1` CPI helper.
9+
pub struct Instruction1 {}
10+
11+
impl Instruction1 {
12+
#[inline(always)]
13+
pub fn invoke(&self) -> pinocchio::ProgramResult {
14+
self.invoke_signed(&[])
15+
}
16+
17+
pub fn invoke_signed(
18+
&self,
19+
_signers: &[pinocchio::instruction::Signer],
20+
) -> pinocchio::ProgramResult {
21+
Ok(())
22+
}
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//! This code was AUTOGENERATED using the codama library.
2+
//! Please DO NOT EDIT THIS FILE, instead use visitors
3+
//! to add features, then rerun codama to update it.
4+
//!
5+
//! <https://github.com/codama-idl/codama>
6+
//!
7+
8+
/// `instruction2` CPI helper.
9+
pub struct Instruction2 {}
10+
11+
impl Instruction2 {
12+
#[inline(always)]
13+
pub fn invoke(&self) -> pinocchio::ProgramResult {
14+
self.invoke_signed(&[])
15+
}
16+
17+
pub fn invoke_signed(
18+
&self,
19+
_signers: &[pinocchio::instruction::Signer],
20+
) -> pinocchio::ProgramResult {
21+
Ok(())
22+
}
23+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//! This code was AUTOGENERATED using the codama library.
2+
//! Please DO NOT EDIT THIS FILE, instead use visitors
3+
//! to add features, then rerun codama to update it.
4+
//!
5+
//! <https://github.com/codama-idl/codama>
6+
//!
7+
8+
/// `instruction3` CPI helper.
9+
pub struct Instruction3 {}
10+
11+
impl Instruction3 {
12+
#[inline(always)]
13+
pub fn invoke(&self) -> pinocchio::ProgramResult {
14+
self.invoke_signed(&[])
15+
}
16+
17+
pub fn invoke_signed(
18+
&self,
19+
_signers: &[pinocchio::instruction::Signer],
20+
) -> pinocchio::ProgramResult {
21+
Ok(())
22+
}
23+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//! This code was AUTOGENERATED using the codama library.
2+
//! Please DO NOT EDIT THIS FILE, instead use visitors
3+
//! to add features, then rerun codama to update it.
4+
//!
5+
//! <https://github.com/codama-idl/codama>
6+
//!
7+
8+
/// `instruction4` CPI helper.
9+
pub struct Instruction4 {
10+
pub my_argument: u64,
11+
}
12+
13+
impl Instruction4 {
14+
#[inline(always)]
15+
pub fn invoke(&self) -> pinocchio::ProgramResult {
16+
self.invoke_signed(&[])
17+
}
18+
19+
pub fn invoke_signed(
20+
&self,
21+
_signers: &[pinocchio::instruction::Signer],
22+
) -> pinocchio::ProgramResult {
23+
Ok(())
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//! This code was AUTOGENERATED using the codama library.
2+
//! Please DO NOT EDIT THIS FILE, instead use visitors
3+
//! to add features, then rerun codama to update it.
4+
//!
5+
//! <https://github.com/codama-idl/codama>
6+
//!
7+
8+
/// `instruction5` CPI helper.
9+
pub struct Instruction5 {
10+
pub my_argument: u64,
11+
}
12+
13+
impl Instruction5 {
14+
#[inline(always)]
15+
pub fn invoke(&self) -> pinocchio::ProgramResult {
16+
self.invoke_signed(&[])
17+
}
18+
19+
pub fn invoke_signed(
20+
&self,
21+
_signers: &[pinocchio::instruction::Signer],
22+
) -> pinocchio::ProgramResult {
23+
Ok(())
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//! This code was AUTOGENERATED using the codama library.
2+
//! Please DO NOT EDIT THIS FILE, instead use visitors
3+
//! to add features, then rerun codama to update it.
4+
//!
5+
//! <https://github.com/codama-idl/codama>
6+
//!
7+
8+
/// `instruction6` CPI helper.
9+
pub struct Instruction6<'a> {
10+
pub my_account: &'a pinocchio::account_info::AccountInfo,
11+
}
12+
13+
impl<'a> Instruction6<'a> {
14+
#[inline(always)]
15+
pub fn invoke(&self) -> pinocchio::ProgramResult {
16+
self.invoke_signed(&[])
17+
}
18+
19+
pub fn invoke_signed(
20+
&self,
21+
_signers: &[pinocchio::instruction::Signer],
22+
) -> pinocchio::ProgramResult {
23+
Ok(())
24+
}
25+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//! This code was AUTOGENERATED using the codama library.
2+
//! Please DO NOT EDIT THIS FILE, instead use visitors
3+
//! to add features, then rerun codama to update it.
4+
//!
5+
//! <https://github.com/codama-idl/codama>
6+
//!
7+
8+
/// `instruction7` CPI helper.
9+
pub struct Instruction7<'a> {
10+
pub my_account: Option<&'a pinocchio::account_info::AccountInfo>,
11+
}
12+
13+
impl<'a> Instruction7<'a> {
14+
#[inline(always)]
15+
pub fn invoke(&self) -> pinocchio::ProgramResult {
16+
self.invoke_signed(&[])
17+
}
18+
19+
pub fn invoke_signed(
20+
&self,
21+
_signers: &[pinocchio::instruction::Signer],
22+
) -> pinocchio::ProgramResult {
23+
Ok(())
24+
}
25+
}

0 commit comments

Comments
 (0)