tests: Updated tests for Regex with more UTF-8 regexps
authorLucas Bajolet <r4pass@hotmail.com>
Wed, 9 Sep 2015 17:45:10 +0000 (13:45 -0400)
committerLucas Bajolet <r4pass@hotmail.com>
Wed, 9 Sep 2015 17:45:10 +0000 (13:45 -0400)
Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

tests/sav/nitserial_args1.res
tests/sav/test_regex_check.res
tests/test_regex_check.nit

index 2d0898a..fe675df 100644 (file)
@@ -14,6 +14,7 @@ redef class Deserializer
                if name == "Array[Serializable]" then return new Array[Serializable].from_deserializer(self)
                if name == "Array[Object]" then return new Array[Object].from_deserializer(self)
                if name == "Array[Match]" then return new Array[Match].from_deserializer(self)
+               if name == "Array[nullable Match]" then return new Array[nullable Match].from_deserializer(self)
                return super
        end
 end
index 47b6906..7fc9b83 100644 (file)
@@ -2,3 +2,14 @@ true
 false
 [é12,45]
 [é1234,]
+rés, rés, rés
+ついほ
+Match found : あ
+Submatches: 
+[0] : null 
+Match found : あの
+Submatches: 
+[0] : の 
+Match found : あ
+Submatches: 
+[0] : null 
index 8c3efda..3bd703a 100644 (file)
@@ -27,3 +27,19 @@ print str.split(re1)
 
 var re2 = "5".to_re
 print str.split(re2)
+
+str = "résonnance réseau résultat"
+
+print str.search_all("rés".to_re).join(", ")
+
+str = "あついあのあほ"
+print str.split("あ(の)?".to_re).join("")
+
+for i in str.search_all("あ(の)?".to_re) do
+       print "Match found : {i}"
+       print "Submatches: "
+       var sbs = i.subs
+       for j in sbs.length.times do
+               print "[{j}] : {sbs[j] or else "null"} "
+       end
+end