File tree Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Expand file tree Collapse file tree 3 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 50
50
run : cargo test -p rustc_codegen_spirv --release --no-default-features --features "use-installed-tools"
51
51
52
52
- name : workspace test (excluding examples & difftest)
53
- run : cargo test --release --workspace --exclude "example-runner-*" --exclude "difftest*" --no-default-features --features use-installed-tools,include_str
53
+ run : cargo test --release --workspace --exclude "example-runner-*" --exclude "difftest*" --no-default-features --features use-installed-tools,include_str,clap
54
54
55
55
# Examples
56
56
- name : cargo check examples
Original file line number Diff line number Diff line change 73
73
#![ doc = include_str ! ( "../README.md" ) ]
74
74
75
75
mod depfile;
76
+ #[ cfg( test) ]
77
+ mod tests;
76
78
#[ cfg( feature = "watch" ) ]
77
79
mod watch;
78
80
Original file line number Diff line number Diff line change
1
+ #[ cfg( feature = "clap" ) ]
2
+ mod clap {
3
+ pub use crate :: * ;
4
+ use clap:: Parser ;
5
+
6
+ /// look at the output of this test to see what `--help` prints
7
+ #[ test]
8
+ fn test_clap_help ( ) {
9
+ match SpirvBuilder :: try_parse_from ( [ "" , "--help" ] ) {
10
+ Ok ( _) => panic ! ( "help must fail to parse" ) ,
11
+ Err ( e) => {
12
+ let e = e. to_string ( ) ;
13
+ println ! ( "{}" , e) ;
14
+ assert ! ( e. contains( "--target" ) ) ;
15
+ }
16
+ } ;
17
+ }
18
+
19
+ #[ test]
20
+ fn test_clap_target ( ) {
21
+ let env = SpirvTargetEnv :: OpenGL_4_2 ;
22
+ let builder = SpirvBuilder :: try_parse_from ( [ "" , "--target" , & env. target_triple ( ) ] )
23
+ . map_err ( |e| e. to_string ( ) )
24
+ . unwrap ( ) ;
25
+ assert_eq ! ( builder. target, Some ( env) ) ;
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments