File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -91,7 +91,7 @@ impl<'src> Justfile<'src> {
9191 config,
9292 dotenv,
9393 & BTreeMap :: new ( ) ,
94- root ,
94+ scope ,
9595 scopes,
9696 search,
9797 ) ?;
Original file line number Diff line number Diff line change @@ -1018,3 +1018,54 @@ fn overrides_work_when_submodule_is_present() {
10181018 . stdout ( "b\n " )
10191019 . run ( ) ;
10201020}
1021+
1022+ #[ test]
1023+ fn exported_variables_are_available_in_submodules ( ) {
1024+ Test :: new ( )
1025+ . write ( "foo.just" , "bar:\n @echo $x" )
1026+ . justfile (
1027+ "
1028+ mod foo
1029+
1030+ export x := 'a'
1031+ " ,
1032+ )
1033+ . test_round_trip ( false )
1034+ . arg ( "foo::bar" )
1035+ . stdout ( "a\n " )
1036+ . run ( ) ;
1037+ }
1038+
1039+ #[ test]
1040+ fn exported_variables_can_be_unexported_in_submodules ( ) {
1041+ Test :: new ( )
1042+ . write ( "foo.just" , "unexport x\n bar:\n @echo ${x:-default}" )
1043+ . justfile (
1044+ "
1045+ mod foo
1046+
1047+ export x := 'a'
1048+ " ,
1049+ )
1050+ . test_round_trip ( false )
1051+ . arg ( "foo::bar" )
1052+ . stdout ( "default\n " )
1053+ . run ( ) ;
1054+ }
1055+
1056+ #[ test]
1057+ fn exported_variables_can_be_overridden_in_submodules ( ) {
1058+ Test :: new ( )
1059+ . write ( "foo.just" , "export x := 'b'\n bar:\n @echo $x" )
1060+ . justfile (
1061+ "
1062+ mod foo
1063+
1064+ export x := 'a'
1065+ " ,
1066+ )
1067+ . test_round_trip ( false )
1068+ . arg ( "foo::bar" )
1069+ . stdout ( "b\n " )
1070+ . run ( ) ;
1071+ }
You can’t perform that action at this time.
0 commit comments