File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11(ns xapi-schema.spec.regex
22 (:require [clojure.string :refer [join]]))
33
4- (def LanguageTagRegEx ; RFC 5646, w/ lang subtag limitation
4+ (def LanguageTagRegEx ; RFC 5646, w/ lang subtag limitation
55 (let [; ; Language Subtags
66 ; ; Note: we exclude 4-8 char subtags, even though they are allowed in
77 ; ; the RFC spec, since they are reserved for future (not current) use.
148148(def xAPIVersionRegEx
149149 (let [suf-part " [0-9a-zA-Z-]+(?:\\ .[0-9a-zA-Z-]+)*"
150150 suffix (str " (\\ .[0-9]+(?:-" suf-part " )?(?:\\ +" suf-part " )?)?" )
151- ver-str (str " ^1 \\ .0" suffix " $" )]
151+ ver-str (str " ^[1-2] \\ .0" suffix " $" )]
152152 (re-pattern ver-str)))
153153
154154(def Base64RegEx
Original file line number Diff line number Diff line change 148148 (re-matches xAPIVersionRegEx " 1.0.2" )
149149 (re-matches xAPIVersionRegEx " 1.0" )
150150 (re-matches xAPIVersionRegEx " 1.0.32-abc.def+ghi.jkl" )))
151- (is (not (re-matches xAPIVersionRegEx " 0.9.5" )))))
151+ (is (not (re-matches xAPIVersionRegEx " 0.9.5" ))))
152+ (testing " matches xAPI 2.0.x versions"
153+ (is (and (re-matches xAPIVersionRegEx " 2.0.0" )
154+ (re-matches xAPIVersionRegEx " 2.0.2" )
155+ (re-matches xAPIVersionRegEx " 2.0" )
156+ (re-matches xAPIVersionRegEx " 2.0.32-abc.def+ghi.jkl" )))))
152157
153158(deftest duration-regex-test
154159 (testing " matches ISO durations"
You can’t perform that action at this time.
0 commit comments