File tree Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Expand file tree Collapse file tree 1 file changed +56
-0
lines changed Original file line number Diff line number Diff line change @@ -948,6 +948,62 @@ pub mod tests {
948948 assert_eq ! ( config. get_deprecations( ) . is_empty( ) , true ) ;
949949 }
950950
951+ #[ test]
952+ fn test_compiler_flags ( ) {
953+ let json = r#"
954+ {
955+ "name": "testrepo",
956+ "sources": {
957+ "dir": "src",
958+ "subdirs": true
959+ },
960+ "package-specs": [
961+ {
962+ "module": "es6",
963+ "in-source": true
964+ }
965+ ],
966+ "suffix": ".mjs",
967+ "compiler-flags": [ "-w" ]
968+ }
969+ "# ;
970+
971+ let config = Config :: new_from_json_string ( json) . expect ( "a valid json string" ) ;
972+ if let Some ( flags) = & config. compiler_flags {
973+ if let Some ( OneOrMore :: Single ( flag) ) = flags. get ( 0 ) {
974+ assert_eq ! ( flag. as_str( ) , "-w" ) ;
975+ }
976+ } else {
977+ dbg ! ( config. compiler_flags) ;
978+ unreachable ! ( )
979+ }
980+ assert_eq ! ( config. get_deprecations( ) . is_empty( ) , true ) ;
981+ }
982+
983+ #[ test]
984+ fn test_compiler_flags_deprecation ( ) {
985+ let json = r#"
986+ {
987+ "name": "testrepo",
988+ "sources": {
989+ "dir": "src",
990+ "subdirs": true
991+ },
992+ "package-specs": [
993+ {
994+ "module": "es6",
995+ "in-source": true
996+ }
997+ ],
998+ "suffix": ".mjs",
999+ "bsc-flags": [ "-w" ]
1000+ }
1001+ "# ;
1002+
1003+ let config = Config :: new_from_json_string ( json) . expect ( "a valid json string" ) ;
1004+ assert_eq ! ( config. get_deprecations( ) , [ DeprecationWarning :: BscFlags ] ) ;
1005+ }
1006+
9511007 fn test_find_is_type_dev ( source : OneOrMore < Source > , path : & Path , expected : bool ) {
9521008 let config = Config {
9531009 name : String :: from ( "testrepo" ) ,
You can’t perform that action at this time.
0 commit comments