@@ -30,6 +30,8 @@ def test_file(self):
3030 local_shell .write_file ("temp/test.txt" , "Test" )
3131 self .assertTrue (local_shell .file_exists ("temp/test.txt" ))
3232 self .assertEqual ("Test" , local_shell .read_file ("temp/test.txt" ).strip ())
33+ local_shell .sed_replace_in_file_plain ("temp/test.txt" , "Tes" , "ABc" )
34+ self .assertEqual ("ABct" , local_shell .read_file ("temp/test.txt" ).strip ())
3335 with open ("temp/test.txt" , "w+" ) as f :
3436 writer = InstantWriter (f )
3537 writer .write ("Ano/.ther testno/.ther" )
@@ -49,6 +51,16 @@ def test_file(self):
4951 self .assertTrue (True )
5052 local_shell .remove_recursive ("temp" )
5153
54+ def test_sed_replace (self ):
55+ local_shell = LocalShell ()
56+ local_shell .remove_force ("temp" )
57+ local_shell .make_full_dir ("temp" )
58+ local_shell .write_file ("temp/testA.txt" , "This is a blue world blue world" )
59+ local_shell .sed_replace_in_file_plain ("temp/testA.txt" , "blue world" , "green planet" )
60+ self .assertEqual ("This is a green planet green planet" , local_shell .read_file ("temp/testA.txt" ).strip ())
61+ local_shell .remove ("temp/testA.txt" )
62+ local_shell .remove_recursive ("temp" )
63+
5264 def test_dir (self ):
5365 local_shell = LocalShell ()
5466 local_shell .make_full_dir ("temp" )
0 commit comments