File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
helix-term/tests/test/commands Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -933,3 +933,33 @@ async fn test_move_file_when_given_dir_only() -> anyhow::Result<()> {
933933
934934 Ok ( ( ) )
935935}
936+
937+ #[ tokio:: test( flavor = "multi_thread" ) ]
938+ #[ cfg( unix) ]
939+ async fn test_write_ownership ( ) -> anyhow:: Result < ( ) > {
940+ // GH CI does not possess CAP_CHOWN
941+ if option_env ! ( "GITHUB_ACTIONS" ) . is_some ( ) {
942+ return Ok ( ( ) ) ;
943+ }
944+ use std:: os:: unix:: fs:: MetadataExt ;
945+
946+ let mut file = tempfile:: NamedTempFile :: new ( ) ?;
947+ let mut app = helpers:: AppBuilder :: new ( )
948+ . with_file ( file. path ( ) , None )
949+ . build ( ) ?;
950+
951+ let nobody_uid = 9999 ;
952+ let nogroup_gid = 9999 ;
953+
954+ helix_stdx:: faccess:: fchown ( & file. as_file_mut ( ) , Some ( nobody_uid) , Some ( nogroup_gid) ) ?;
955+
956+ let old_meta = file. as_file ( ) . metadata ( ) ?;
957+
958+ test_key_sequence ( & mut app, Some ( "hello:w<ret>" ) , None , false ) . await ?;
959+ reload_file ( & mut file) . unwrap ( ) ;
960+
961+ let new_meta = file. as_file ( ) . metadata ( ) ?;
962+ assert ! ( old_meta. uid( ) == new_meta. uid( ) && old_meta. gid( ) == new_meta. gid( ) ) ;
963+
964+ Ok ( ( ) )
965+ }
You can’t perform that action at this time.
0 commit comments