@@ -2,7 +2,10 @@ use assert_fs::assert::PathAssert;
2
2
use assert_fs:: fixture:: PathChild ;
3
3
use assert_fs:: TempDir ;
4
4
use indoc:: indoc;
5
+ use predicates:: prelude:: * ;
5
6
use scarb_test_support:: command:: Scarb ;
7
+ use scarb_test_support:: fsx:: ChildPathEx ;
8
+ use scarb_test_support:: predicates:: is_file_empty;
6
9
use scarb_test_support:: project_builder:: ProjectBuilder ;
7
10
use snapbox:: cmd:: OutputAssert ;
8
11
@@ -41,13 +44,13 @@ fn can_execute_default_main_function_from_executable() {
41
44
"# } ) ;
42
45
43
46
t. child ( "target/execute/hello/air_private_input.json" )
44
- . assert ( predicates :: path :: exists ( ) ) ;
47
+ . assert_is_json :: < serde_json :: Value > ( ) ;
45
48
t. child ( "target/execute/hello/air_public_input.json" )
46
- . assert ( predicates :: path :: exists ( ) ) ;
49
+ . assert_is_json :: < serde_json :: Value > ( ) ;
47
50
t. child ( "target/execute/hello/memory.bin" )
48
- . assert ( predicates:: path:: exists ( ) ) ;
51
+ . assert ( predicates:: path:: exists ( ) . and ( is_file_empty ( ) . not ( ) ) ) ;
49
52
t. child ( "target/execute/hello/trace.bin" )
50
- . assert ( predicates:: path:: exists ( ) ) ;
53
+ . assert ( predicates:: path:: exists ( ) . and ( is_file_empty ( ) . not ( ) ) ) ;
51
54
}
52
55
53
56
#[ test]
@@ -66,13 +69,39 @@ fn can_execute_prebuilt_executable() {
66
69
"# } ) ;
67
70
68
71
t. child ( "target/execute/hello/air_private_input.json" )
69
- . assert ( predicates :: path :: exists ( ) ) ;
72
+ . assert_is_json :: < serde_json :: Value > ( ) ;
70
73
t. child ( "target/execute/hello/air_public_input.json" )
71
- . assert ( predicates :: path :: exists ( ) ) ;
74
+ . assert_is_json :: < serde_json :: Value > ( ) ;
72
75
t. child ( "target/execute/hello/memory.bin" )
73
- . assert ( predicates:: path:: exists ( ) ) ;
76
+ . assert ( predicates:: path:: exists ( ) . and ( is_file_empty ( ) . not ( ) ) ) ;
74
77
t. child ( "target/execute/hello/trace.bin" )
75
- . assert ( predicates:: path:: exists ( ) ) ;
78
+ . assert ( predicates:: path:: exists ( ) . and ( is_file_empty ( ) . not ( ) ) ) ;
79
+ }
80
+
81
+ #[ test]
82
+ fn can_execute_bootloader_target ( ) {
83
+ let t = build_executable_project ( ) ;
84
+ Scarb :: quick_snapbox ( )
85
+ . arg ( "execute" )
86
+ . arg ( "--target=bootloader" )
87
+ . current_dir ( & t)
88
+ . assert ( )
89
+ . success ( )
90
+ . stdout_matches ( indoc ! { r#"
91
+ [..]Compiling hello v0.1.0 ([..]Scarb.toml)
92
+ [..]Finished `dev` profile target(s) in [..]
93
+ [..]Executing hello
94
+ Saving output to: target/execute/hello
95
+ "# } ) ;
96
+
97
+ t. child ( "target/execute/hello/air_private_input.json" )
98
+ . assert_is_json :: < serde_json:: Value > ( ) ;
99
+ t. child ( "target/execute/hello/air_public_input.json" )
100
+ . assert_is_json :: < serde_json:: Value > ( ) ;
101
+ t. child ( "target/execute/hello/memory.bin" )
102
+ . assert ( predicates:: path:: exists ( ) . and ( is_file_empty ( ) . not ( ) ) ) ;
103
+ t. child ( "target/execute/hello/trace.bin" )
104
+ . assert ( predicates:: path:: exists ( ) . and ( is_file_empty ( ) . not ( ) ) ) ;
76
105
}
77
106
78
107
#[ test]
0 commit comments