Skip to content

Commit 2427b02

Browse files
committed
Allow 2.0.x versions
1 parent 77f78d1 commit 2427b02

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

src/xapi_schema/spec/regex.cljc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
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.
@@ -148,7 +148,7 @@
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

test/xapi_schema/spec/regex_test.cljc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,12 @@
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"

0 commit comments

Comments
 (0)