Skip to content

Instantly share code, notes, and snippets.

@swannodette
Last active June 10, 2016 13:27
Show Gist options
  • Save swannodette/c1444684bc2a8236634e4e110c654fe5 to your computer and use it in GitHub Desktop.
Save swannodette/c1444684bc2a8236634e4e110c654fe5 to your computer and use it in GitHub Desktop.
(ns om.next.spec
(:require [cljs.spec :as s]
[clojure.test.check :as tc]
[clojure.test.check.properties :as tcp]))
(s/def ::statics
(s/cat
:static '#{static}
:protocol-name '#{om.next/Ident om.next/IQuery om.next/IQueryParams}
:impls (s/* seq?)))
(s/def ::protocols
(s/cat
:protocol-name (s/& symbol? #(not= 'static %))
:impls (s/* seq?)))
(s/def ::methods
(s/alt :statics ::statics
:protocols ::protocols))
(s/def ::defui
(s/cat :defui '#{defui}
:name symbol?
:impls (s/* ::methods)))
(s/explain ::defui
'(defui Foo
static om.next/Ient
(ident [this props])
Object
(render [this]
)
(shouldComponentUpdate [this next-props next-state])))
;; In: [3] val: om.next/Ient fails at: [:impls :statics :protocol-name] predicate: (quote #{Ident IQueryParams IQuery})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment