File tree Expand file tree Collapse file tree 10 files changed +101
-2
lines changed
Expand file tree Collapse file tree 10 files changed +101
-2
lines changed Original file line number Diff line number Diff line change @@ -464,6 +464,8 @@ jobs:
464464 path : tests/idl
465465 - cmd : cd tests/lazy-account && anchor test
466466 path : tests/lazy-account
467+ - cmd : cd tests/post2018-template && anchor test --skip-lint
468+ path : tests/post2018-template
467469 steps :
468470 - uses : actions/checkout@v3
469471 - uses : ./.github/actions/setup/
Original file line number Diff line number Diff line change @@ -149,7 +149,7 @@ pub enum ErrorCode {
149149 . into( ) ,
150150 ) ,
151151 (
152- src_path. join( "instructions" ) . join ( "mod .rs") ,
152+ src_path. join( "instructions.rs" ) ,
153153 r#"pub mod initialize;
154154
155155pub use initialize::*;
@@ -170,7 +170,7 @@ pub fn handler(ctx: Context<Initialize>) -> Result<()> {
170170"#
171171 . into( ) ,
172172 ) ,
173- ( src_path. join( "state" ) . join ( "mod .rs") , r#""# . into( ) ) ,
173+ ( src_path. join( "state.rs" ) , r#""# . into( ) ) ,
174174 ]
175175}
176176
Original file line number Diff line number Diff line change 1+ [provider ]
2+ cluster = " localnet"
3+ wallet = " ~/.config/solana/id.json"
4+
5+ [programs .localnet ]
6+ template_multiple_files = " CwrqeMj2U8tFr1Rhkgwc84tpAsqbt9pTt2a4taoTADPr"
Original file line number Diff line number Diff line change 1+ [workspace ]
2+ members = [
3+ " programs/*"
4+ ]
5+ resolver = " 2"
6+
7+ [profile .release ]
8+ overflow-checks = true
9+ lto = " fat"
10+ codegen-units = 1
11+ [profile .release .build-override ]
12+ opt-level = 3
13+ incremental = false
14+ codegen-units = 1
15+
Original file line number Diff line number Diff line change 1+ [package ]
2+ name = " template"
3+ version = " 0.1.0"
4+ description = " Test for multiple file template structure"
5+ edition = " 2021"
6+
7+ [lib ]
8+ crate-type = [" cdylib" , " lib" ]
9+ name = " template_multiple_files"
10+
11+ [features ]
12+ default = []
13+ cpi = [" no-entrypoint" ]
14+ no-entrypoint = []
15+ no-idl = []
16+ no-log-ix-name = []
17+ idl-build = [" anchor-lang/idl-build" ]
18+
19+ [dependencies ]
20+ anchor-lang = { path = " ../../../../lang" }
21+
Original file line number Diff line number Diff line change 1+ pub mod initialize;
2+
3+ pub use initialize:: * ;
Original file line number Diff line number Diff line change 1+ use anchor_lang:: prelude:: * ;
2+ use crate :: state:: * ;
3+
4+ #[ derive( Accounts ) ]
5+ pub struct Initialize < ' info > {
6+ #[ account(
7+ init,
8+ payer = user,
9+ space = 8 + MyAccount :: INIT_SPACE
10+ ) ]
11+ pub account : Account < ' info , MyAccount > ,
12+ #[ account( mut ) ]
13+ pub user : Signer < ' info > ,
14+ pub system_program : Program < ' info , System > ,
15+ }
16+
17+ pub fn handler ( ctx : Context < Initialize > ) -> Result < ( ) > {
18+ let account = & mut ctx. accounts . account ;
19+ account. data = 0 ;
20+ msg ! ( "Account initialized with data: {}" , account. data) ;
21+ Ok ( ( ) )
22+ }
23+
Original file line number Diff line number Diff line change 1+ pub mod instructions;
2+ pub mod state;
3+
4+ use anchor_lang:: prelude:: * ;
5+
6+ pub use instructions:: * ;
7+ pub use state:: * ;
8+
9+ declare_id ! ( "CwrqeMj2U8tFr1Rhkgwc84tpAsqbt9pTt2a4taoTADPr" ) ;
10+
11+ #[ program]
12+ pub mod template_multiple_files {
13+ use super :: * ;
14+
15+ pub fn initialize ( ctx : Context < Initialize > ) -> Result < ( ) > {
16+ initialize:: handler ( ctx)
17+ }
18+ }
Original file line number Diff line number Diff line change 1+ pub mod state;
2+
3+ pub use state:: * ;
Original file line number Diff line number Diff line change 1+ use anchor_lang:: prelude:: * ;
2+
3+ #[ account]
4+ #[ derive( InitSpace ) ]
5+ pub struct MyAccount {
6+ pub data : u64 ,
7+ }
8+
You can’t perform that action at this time.
0 commit comments