File tree Expand file tree Collapse file tree
src/com/walmartlabs/lacinia/parser
test/com/walmartlabs/lacinia/parser Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5454 (-> v
5555 ; ; Because of how parsing works, the string literal includes the enclosing quotes
5656 (subs 1 (dec (.length v)))
57- (str/replace #"\\ ([\\\"\/ bfnrt])" #(unescape-ascii (second %)))
58- (str/replace #"\\ u([A-Fa-f0-9]{4})" #(unescape-unicode (second %)))))
57+ (str/replace #"\\ (\\ |u[A-Fa-f0-9]{4}|[\"\/ bfnrt])"
58+ #(let [s (second %)]
59+ (cond
60+ (= s " \\ " ) " \\ "
61+ (= (first s) \u) (unescape-unicode (subs s 1 ))
62+ :else (unescape-ascii s))))))
5963
6064(defn ^:private indent-of
6165 [s]
Original file line number Diff line number Diff line change 7373 (testing " unicode"
7474 (is (= {:id " 1138"
7575 :newHomePlanet " ❄HOTH❄" }
76- (args " mutation { changeHeroHomePlanet(id: \" 1138\" , newHomePlanet: \"\\ u2744\\ uff28\\ uff2f\\ uff34\\ uff28\\ u2744\" ) {name}}" )))))
76+ (args " mutation { changeHeroHomePlanet(id: \" 1138\" , newHomePlanet: \"\\ u2744\\ uff28\\ uff2f\\ uff34\\ uff28\\ u2744\" ) {name}}" ))))
77+
78+ (testing " not unicode"
79+ (is (= {:id " 1139"
80+ :newHomePlanet " \\ u2744\\ uff28\\ uff2f\\ uff34\\ uff28\\ u2744" }
81+ (args " mutation { changeHeroHomePlanet(id: \" 1139\" , newHomePlanet: \"\\\\ u2744\\\\ uff28\\\\ uff2f\\\\ uff34\\\\ uff28\\\\ u2744\" ) {name}}" )))))
7782
7883(deftest query-reserved-word
7984 ; ; Use 'query', 'mutation', and 'subscription' in various unusual places.
You can’t perform that action at this time.
0 commit comments