Artifact f3315ba4375819a173c0feb6b7232b0c0683ca07
File
test/merge3.test
part of check-in
[26ab4f7012]
- Additional 3-way-merge test cases.
by
drh on
2009-03-21 19:44:41.
#
# Copyright (c) 2009 D. Richard Hipp
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License version 2 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this library; if not, write to the
# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
# Boston, MA 02111-1307, USA.
#
# Author contact information:
# drh@hwaci.com
# http://www.hwaci.com/drh/
#
############################################################################
#
# Tests of the 3-way merge
#
proc merge-test {testid basis v1 v2 result} {
write_file t1 [join [string trim $basis] \n]\n
write_file t2 [join [string trim $v1] \n]\n
write_file t3 [join [string trim $v2] \n]\n
fossil test-3-way-merge t1 t2 t3 t4
set x [read_file t4]
regsub -all {>>>>>>> BEGIN MERGE CONFLICT} $x {>} x
regsub -all {============================} $x {=} x
regsub -all {<<<<<<< END MERGE CONFLICT} $x {<} x
set x [split [string trim $x] \n]
set result [string trim $result]
if {$x!=$result} {
puts " Expected \[$result\]"
puts " Got \[$x\]"
test merge3-$testid 0
} else {
test merge3-$testid 1
}
}
merge-test 1 {
1 2 3 4 5 6 7 8 9
} {
1 2 3b 4 5 6 7 8 9
} {
1 2 3 4 5c 6 7 8 9
} {
1 2 3b 4 5c 6 7 8 9
}
merge-test 2 {
1 2 3 4 5 6 7 8 9
} {
1 2 3b 4b 5 6 7 8 9
} {
1 2 3 4 5c 6 7 8 9
} {
1 2 3b 4b 5c 6 7 8 9
}
merge-test 3 {
1 2 3 4 5 6 7 8 9
} {
1 2 3b 4b 5b 6 7 8 9
} {
1 2 3 4 5c 6 7 8 9
} {
1 2 > 3b 4b 5b = 3 4 5c < 6 7 8 9
}
merge-test 4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