3535import supybot .conf as conf
3636import supybot .registry as registry
3737
38+ conf .registerGlobalValue (conf .supybot , 'testRegexp1' ,
39+ registry .Regexp (r'm/(example\.org)/' , 'this is a test registry variable' ))
40+ conf .registerGlobalValue (conf .supybot , 'testRegexp2' ,
41+ registry .Regexp (r'm/(example\.org)/' , 'this is a test registry variable' ))
42+
3843join = registry .join
3944split = registry .split
4045escape = registry .escape
@@ -280,11 +285,14 @@ def _testReload(self):
280285 .getSpecific (network = 'testreloadnet' ,
281286 channel = '#testreloadchan' )(),
282287 '#' )
288+ self .assertEqual (conf .supybot .testRegexp1 ().pattern , r'(example\.org)' )
289+ self .assertEqual (conf .supybot .testRegexp2 ().pattern , r'(example\.org)' )
283290
284291 filename = conf .supybot .directories .conf .dirize ('reload.conf' )
285292 registry .close (conf .supybot , filename )
286293 with open (filename , 'at' ) as fd :
287- fd .write ('supybot.reply.whenAddressedBy.chars: !' )
294+ fd .write ('supybot.reply.whenAddressedBy.chars: !\n ' )
295+ fd .write ('supybot.testRegexp1: m/example\\ \\ .com/\n ' )
288296
289297 registry .open_registry (filename )
290298
@@ -299,6 +307,7 @@ def _testReload(self):
299307 self .assertEqual (conf .supybot .reply .whenAddressedBy .chars
300308 .getSpecific (channel = '#testchan' )(),
301309 '!' )
310+ self .assertEqual (conf .supybot .testRegexp1 ().pattern , r'example\.com' )
302311
303312 # remain unchanged
304313 self .assertEqual (conf .supybot .reply .whenAddressedBy .chars
@@ -308,6 +317,7 @@ def _testReload(self):
308317 .getSpecific (network = 'testreloadnet' ,
309318 channel = '#testreloadchan' )(),
310319 '#' )
320+ self .assertEqual (conf .supybot .testRegexp2 ().pattern , r'(example\.org)' )
311321
312322 def testWith (self ):
313323 v = registry .String ('foo' , 'help' )
0 commit comments