Fossil SCM
Add more tags manifest test cases. Check the manifest.tags contents updates on tagging, commit and switching branches. Tests pass successfully on OS X.
Commit
2350b0681eaa9397cecfca5bfa32be5cf28638ab
Parent
c33f02de133f6c1…
1 file changed
+44
-1
+44
-1
| --- test/set-manifest.test | ||
| +++ test/set-manifest.test | ||
| @@ -15,10 +15,23 @@ | ||
| 15 | 15 | # |
| 16 | 16 | ############################################################################ |
| 17 | 17 | # |
| 18 | 18 | # Test manifest setting |
| 19 | 19 | # |
| 20 | + | |
| 21 | +proc file_contains {fname match} { | |
| 22 | + set fp [open $fname r] | |
| 23 | + set contents [read $fp] | |
| 24 | + close $fp | |
| 25 | + set lines [split $contents "\n"] | |
| 26 | + foreach line $lines { | |
| 27 | + if {[regexp $match $line]} { | |
| 28 | + return 1 | |
| 29 | + } | |
| 30 | + } | |
| 31 | + return 0 | |
| 32 | +} | |
| 20 | 33 | |
| 21 | 34 | # We need a respository, so let it have one. |
| 22 | 35 | test_setup |
| 23 | 36 | |
| 24 | 37 | #### Verify classic behavior of the manifest setting |
| @@ -82,8 +95,38 @@ | ||
| 82 | 95 | } |
| 83 | 96 | |
| 84 | 97 | # Quick check for tags applied in trunk |
| 85 | 98 | test_file_contents "set-manifest-6" "manifest.tags" "branch=trunk\ntrunk\n" |
| 86 | 99 | |
| 87 | -# TODO: check content of manifest.tags file under more conditions | |
| 100 | + | |
| 101 | +##### Test manifest.tags file content updates after commits | |
| 102 | + | |
| 103 | +# Explicitly set manifest.tags mode | |
| 104 | +fossil set manifest t | |
| 105 | +test "set-manifest-7-1" {[file isfile manifest.tags]} | |
| 106 | + | |
| 107 | +# Add a tag and make sure it appears in manifest.tags | |
| 108 | +fossil tag add manifest-7-tag-1 tip | |
| 109 | +test "set-manifest-7-2" {[file_contains "manifest.tags" "^manifest-7-tag-1$"]} | |
| 110 | + | |
| 111 | +# Add a file and make sure tag has disappeared from manifest.tags | |
| 112 | +write_file file1 "file1 contents" | |
| 113 | +fossil add file1 | |
| 114 | +fossil commit -m "Added file1." | |
| 115 | +test "set-manifest-7-3" {![file_contains "manifest.tags" "^manifest-7-tag-1$"]} | |
| 116 | + | |
| 117 | +# Add new tag and check that it is in manifest.tags | |
| 118 | +fossil tag add manifest-7-tag-2 tip | |
| 119 | +test "set-manifest-7-4" {[file_contains "manifest.tags" "^manifest-7-tag-2$"]} | |
| 120 | + | |
| 121 | + | |
| 122 | +##### Tags manifest branch= updates | |
| 123 | + | |
| 124 | +# Add file, create new branch on commit and check that | |
| 125 | +# manifest.tags has been updated appropriately | |
| 126 | +write_file file3 "file3 contents" | |
| 127 | +fossil add file3 | |
| 128 | +fossil commit -m "Added file3." --branch manifest-8-branch | |
| 129 | +test "set-manifest-8" {[file_contains "manifest.tags" "^branch=manifest-8-branch$"]} | |
| 130 | + | |
| 88 | 131 | |
| 89 | 132 | test_cleanup |
| 90 | 133 |
| --- test/set-manifest.test | |
| +++ test/set-manifest.test | |
| @@ -15,10 +15,23 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test manifest setting |
| 19 | # |
| 20 | |
| 21 | # We need a respository, so let it have one. |
| 22 | test_setup |
| 23 | |
| 24 | #### Verify classic behavior of the manifest setting |
| @@ -82,8 +95,38 @@ | |
| 82 | } |
| 83 | |
| 84 | # Quick check for tags applied in trunk |
| 85 | test_file_contents "set-manifest-6" "manifest.tags" "branch=trunk\ntrunk\n" |
| 86 | |
| 87 | # TODO: check content of manifest.tags file under more conditions |
| 88 | |
| 89 | test_cleanup |
| 90 |
| --- test/set-manifest.test | |
| +++ test/set-manifest.test | |
| @@ -15,10 +15,23 @@ | |
| 15 | # |
| 16 | ############################################################################ |
| 17 | # |
| 18 | # Test manifest setting |
| 19 | # |
| 20 | |
| 21 | proc file_contains {fname match} { |
| 22 | set fp [open $fname r] |
| 23 | set contents [read $fp] |
| 24 | close $fp |
| 25 | set lines [split $contents "\n"] |
| 26 | foreach line $lines { |
| 27 | if {[regexp $match $line]} { |
| 28 | return 1 |
| 29 | } |
| 30 | } |
| 31 | return 0 |
| 32 | } |
| 33 | |
| 34 | # We need a respository, so let it have one. |
| 35 | test_setup |
| 36 | |
| 37 | #### Verify classic behavior of the manifest setting |
| @@ -82,8 +95,38 @@ | |
| 95 | } |
| 96 | |
| 97 | # Quick check for tags applied in trunk |
| 98 | test_file_contents "set-manifest-6" "manifest.tags" "branch=trunk\ntrunk\n" |
| 99 | |
| 100 | |
| 101 | ##### Test manifest.tags file content updates after commits |
| 102 | |
| 103 | # Explicitly set manifest.tags mode |
| 104 | fossil set manifest t |
| 105 | test "set-manifest-7-1" {[file isfile manifest.tags]} |
| 106 | |
| 107 | # Add a tag and make sure it appears in manifest.tags |
| 108 | fossil tag add manifest-7-tag-1 tip |
| 109 | test "set-manifest-7-2" {[file_contains "manifest.tags" "^manifest-7-tag-1$"]} |
| 110 | |
| 111 | # Add a file and make sure tag has disappeared from manifest.tags |
| 112 | write_file file1 "file1 contents" |
| 113 | fossil add file1 |
| 114 | fossil commit -m "Added file1." |
| 115 | test "set-manifest-7-3" {![file_contains "manifest.tags" "^manifest-7-tag-1$"]} |
| 116 | |
| 117 | # Add new tag and check that it is in manifest.tags |
| 118 | fossil tag add manifest-7-tag-2 tip |
| 119 | test "set-manifest-7-4" {[file_contains "manifest.tags" "^manifest-7-tag-2$"]} |
| 120 | |
| 121 | |
| 122 | ##### Tags manifest branch= updates |
| 123 | |
| 124 | # Add file, create new branch on commit and check that |
| 125 | # manifest.tags has been updated appropriately |
| 126 | write_file file3 "file3 contents" |
| 127 | fossil add file3 |
| 128 | fossil commit -m "Added file3." --branch manifest-8-branch |
| 129 | test "set-manifest-8" {[file_contains "manifest.tags" "^branch=manifest-8-branch$"]} |
| 130 | |
| 131 | |
| 132 | test_cleanup |
| 133 |