mirror of
				https://github.com/TheLocehiliosan/yadm
				synced 2025-06-13 13:03:58 +00:00 
			
		
		
		
	Gracefully handle changes in yadm.cygwin-copy
This commit is contained in:
		
							parent
							
								
									f8e0bd593d
								
							
						
					
					
						commit
						7538851fe3
					
				| @ -1,5 +1,6 @@ | ||||
| load common | ||||
| load_fixtures | ||||
| status=;output=; #; populated by bats run() | ||||
| 
 | ||||
| IN_REPO=(alt*) | ||||
| export TEST_TREE_WITH_CYGWIN=1 | ||||
| @ -14,6 +15,7 @@ test_alt() { | ||||
|   local cygwin_copy="$1" | ||||
|   local is_cygwin="$2" | ||||
|   local expect_link="$3" | ||||
|   local preexisting_link="$4" | ||||
| 
 | ||||
|   case "$cygwin_copy" in | ||||
|     true|false) | ||||
| @ -30,8 +32,17 @@ test_alt() { | ||||
|   local expected_content | ||||
|   expected_content="$T_DIR_WORK/alt-test##$(PATH="$T_TMP:$PATH" uname -s)" | ||||
| 
 | ||||
|   if [ "$preexisting_link" = 'symlink' ]; then | ||||
|     ln -s "$expected_content" "$T_DIR_WORK/alt-test" | ||||
|   elif [ "$preexisting_link" = 'file' ]; then | ||||
|     touch "$T_DIR_WORK/alt-test" | ||||
|   fi | ||||
| 
 | ||||
|   PATH="$T_TMP:$PATH" run "${T_YADM_Y[@]}" alt | ||||
| 
 | ||||
|   echo "Alt output:$output" | ||||
|   echo "Alt status:$status" | ||||
| 
 | ||||
|   if [ -L "$T_DIR_WORK/alt-test" ] && [ "$expect_link" != 'true' ] ; then | ||||
|     echo "ERROR: Alt should be a simple file, but isn't" | ||||
|     return 1 | ||||
| @ -100,3 +111,21 @@ test_alt() { | ||||
|   " | ||||
|   test_alt 'false' 'true' 'true' | ||||
| } | ||||
| 
 | ||||
| @test "Option 'yadm.cygwin-copy' (preexisting symlink) " { | ||||
|   echo " | ||||
|     When the option 'yadm.cygwin-copy' is true | ||||
|     and the OS is CYGWIN | ||||
|     Verify alternate is a copy | ||||
|   " | ||||
|   test_alt 'true' 'true' 'false' 'symlink' | ||||
| } | ||||
| 
 | ||||
| @test "Option 'yadm.cygwin-copy' (preexisting file) " { | ||||
|   echo " | ||||
|     When the option 'yadm.cygwin-copy' is true | ||||
|     and the OS is CYGWIN | ||||
|     Verify alternate is a copy | ||||
|   " | ||||
|   test_alt 'true' 'true' 'false' 'file' | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user