--- /dev/null
+#!/bin/sh
+######################################################
+#
+# Test refile
+#
+######################################################
+
+. "$MH_TEST_COMMON"
+
+
+runandcheck "scan +inbox" <<!
+ 1 2006-09-29 00:00 Test1 Testing message 1
+ 2 2006-09-29 00:00 Test2 Testing message 2
+ 3 2006-09-29 00:00 Test3 Testing message 3
+ 4 2006-09-29 00:00 Test4 Testing message 4
+ 5 2006-09-29 00:00 Test5 Testing message 5
+ 6 2006-09-29 00:00 Test6 Testing message 6
+ 7 2006-09-29 00:00 Test7 Testing message 7
+ 8 2006-09-29 00:00 Test8 Testing message 8
+ 9 2006-09-29 00:00 Test9 Testing message 9
+ 10 2006-09-29 00:00 Test10 Testing message 10
+!
+
+
+# refile one msg from cur folder into one other folder
+
+folder +inbox >/dev/null
+runandcheck "refile 4 +fol1" <<!
+!
+runandcheck folder <<!
+inbox+ has 9 messages (1-10)
+!
+runandcheck "scan +inbox" <<!
+ 1 2006-09-29 00:00 Test1 Testing message 1
+ 2 2006-09-29 00:00 Test2 Testing message 2
+ 3 2006-09-29 00:00 Test3 Testing message 3
+ 5 2006-09-29 00:00 Test5 Testing message 5
+ 6 2006-09-29 00:00 Test6 Testing message 6
+ 7 2006-09-29 00:00 Test7 Testing message 7
+ 8 2006-09-29 00:00 Test8 Testing message 8
+ 9 2006-09-29 00:00 Test9 Testing message 9
+ 10 2006-09-29 00:00 Test10 Testing message 10
+!
+runandcheck "scan +fol1" <<!
+ 1 2006-09-29 00:00 Test4 Testing message 4
+!
+
+
+# refile one msg from cur folder into two other folders
+
+folder +inbox >/dev/null
+runandcheck "refile 6 +fol1 +fol2" <<!
+!
+runandcheck folder <<!
+inbox+ has 8 messages (1-10)
+!
+runandcheck "scan +inbox" <<!
+ 1 2006-09-29 00:00 Test1 Testing message 1
+ 2 2006-09-29 00:00 Test2 Testing message 2
+ 3 2006-09-29 00:00 Test3 Testing message 3
+ 5 2006-09-29 00:00 Test5 Testing message 5
+ 7 2006-09-29 00:00 Test7 Testing message 7
+ 8 2006-09-29 00:00 Test8 Testing message 8
+ 9 2006-09-29 00:00 Test9 Testing message 9
+ 10 2006-09-29 00:00 Test10 Testing message 10
+!
+runandcheck "scan +fol1" <<!
+ 1 2006-09-29 00:00 Test4 Testing message 4
+ 2 2006-09-29 00:00 Test6 Testing message 6
+!
+runandcheck "scan +fol2" <<!
+ 1 2006-09-29 00:00 Test6 Testing message 6
+!
+
+
+# refile two msg from cur folder into two other folders
+
+folder +inbox >/dev/null
+runandcheck "refile 8 9 +fol1 +fol2" <<!
+!
+runandcheck folder <<!
+inbox+ has 6 messages (1-10)
+!
+runandcheck "scan +inbox" <<!
+ 1 2006-09-29 00:00 Test1 Testing message 1
+ 2 2006-09-29 00:00 Test2 Testing message 2
+ 3 2006-09-29 00:00 Test3 Testing message 3
+ 5 2006-09-29 00:00 Test5 Testing message 5
+ 7 2006-09-29 00:00 Test7 Testing message 7
+ 10 2006-09-29 00:00 Test10 Testing message 10
+!
+runandcheck "scan +fol1" <<!
+ 1 2006-09-29 00:00 Test4 Testing message 4
+ 2 2006-09-29 00:00 Test6 Testing message 6
+ 3 2006-09-29 00:00 Test8 Testing message 8
+ 4 2006-09-29 00:00 Test9 Testing message 9
+!
+runandcheck "scan +fol2" <<!
+ 1 2006-09-29 00:00 Test6 Testing message 6
+ 2 2006-09-29 00:00 Test8 Testing message 8
+ 3 2006-09-29 00:00 Test9 Testing message 9
+!
+
+
+# refile one msg from other folder into one other folder
+
+folder +inbox >/dev/null
+runandcheck "refile -src +fol1 1 +fol2" <<!
+!
+# Check new behavior as of mmh-0.3: Current folder stays the same!
+runandcheck folder <<!
+inbox+ has 6 messages (1-10)
+!
+runandcheck "scan +inbox" <<!
+ 1 2006-09-29 00:00 Test1 Testing message 1
+ 2 2006-09-29 00:00 Test2 Testing message 2
+ 3 2006-09-29 00:00 Test3 Testing message 3
+ 5 2006-09-29 00:00 Test5 Testing message 5
+ 7 2006-09-29 00:00 Test7 Testing message 7
+ 10 2006-09-29 00:00 Test10 Testing message 10
+!
+runandcheck "scan +fol1" <<!
+ 2 2006-09-29 00:00 Test6 Testing message 6
+ 3 2006-09-29 00:00 Test8 Testing message 8
+ 4 2006-09-29 00:00 Test9 Testing message 9
+!
+runandcheck "scan +fol2" <<!
+ 1 2006-09-29 00:00 Test6 Testing message 6
+ 2 2006-09-29 00:00 Test8 Testing message 8
+ 3 2006-09-29 00:00 Test9 Testing message 9
+ 4 2006-09-29 00:00 Test4 Testing message 4
+!
+
+
+