Skip to content

Commit

Permalink
Update deps, ensure JDK 11 compatibility, add CI (#40)
Browse files Browse the repository at this point in the history
* fix tests, add .travis.yml

* bump deps + pin CI to openjdk11

* update CI script

* better fix for extra space

* bump schema-tools

* clean up project.clj

* warn on reflection

* add jdk8 to ci

* add pedantic abort

* bump copyright
  • Loading branch information
frenchy64 authored Feb 3, 2020
1 parent 13b95e0 commit f92c65b
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 19 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
language: clojure
lein: 2.9.1
script: lein do clean, test

cache:
directories:
- $HOME/bin
- $HOME/.m2

jdk:
- openjdk8
- openjdk11
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ validators, etc.

## License

Copyright © 2016 Cisco Systems
Copyright © 2016-2020 Cisco Systems

Distributed under the Eclipse Public License either version 1.0 or (at
your option) any later version.
20 changes: 9 additions & 11 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
(def schema-tools-version "0.9.1")
(def schema-version "1.1.7")

(defproject threatgrid/flanders "0.1.23-SNAPSHOT"
:description "flanders"
:url "http://github.com/threatgrid/flanders"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.9.0"]
[org.clojure/core.match "0.3.0-alpha5"
:exclusions [org.clojure/tools.reader]]
[cheshire "5.8.0"]
:pedantic? :abort
:dependencies [[org.clojure/clojure "1.10.1"]
[org.clojure/core.match "0.3.0"]
[cheshire "5.9.0"]

[prismatic/schema ~schema-version]
[metosin/ring-swagger "0.24.4"]
[metosin/schema-tools ~schema-tools-version]]
[prismatic/schema "1.1.12"]
[metosin/ring-swagger "0.26.2"]
[metosin/schema-tools "0.12.2"]]
:global-vars {*warn-on-reflection* true}
:profiles {:dev
{:dependencies [[org.clojure/test.check "0.9.0"]]}})
{:dependencies [[org.clojure/test.check "0.10.0"]]}})
4 changes: 2 additions & 2 deletions src/flanders/markdown.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@
nil)
(->short-description [this]
(str/join ", " (map (fn [schema]
(str (if-some [name (get schema :name)]
(str (when-some [name (get schema :name)]
(str "*" name "* "))
(->short-description schema)))
(get this :parameters))))
Expand Down Expand Up @@ -353,7 +353,7 @@
(->comment this :leaf)
(->usage this :leaf)
(->reference this :leaf)))
(->short-description [this] (str (:name this) " String"))
(->short-description [this] (str (:name this) "String"))

InstType
(->markdown-part [this loc]
Expand Down
13 changes: 8 additions & 5 deletions test/flanders/markdown_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@
[flanders.core :as f]
[flanders.markdown :as f.markdown]))

(deftest signuature-type->markdown
(deftest signature-type->markdown
(is (= "### Signature\n\n() => Anything\n\n\n"
(f.markdown/->markdown (f/sig :parameters []))))

(is (= "### Signature\n\n(Integer) => Anything\n\n\n\n"
(f.markdown/->markdown (f/sig :parameters [(f/int)]))))

(is (= "### Signature\n\n(Integer, String) => Anything\n\n\n\n\n"
(is (= "### Signature\n\n(Integer, String) => Anything\n\n\n\n\n"
(f.markdown/->markdown (f/sig :parameters [(f/int) (f/str)]))))

(is (= "### Signature\n\n(Integer, String ...) => Anything\n\n\n\n\n"
(is (= "### Signature\n\n(Integer, String, Integer, String) => Anything\n\n\n\n\n\n\n"
(f.markdown/->markdown (f/sig :parameters [(f/int) (f/str) (f/int) (f/str)]))))

(is (= "### Signature\n\n(Integer, String ...) => Anything\n\n\n\n\n"
(f.markdown/->markdown (f/sig :parameters [(f/int)] :rest-parameter (f/str)))))

(is (= "### Signature\n\n(Integer, String ...) => Anything\n\n\n\n\n"
(is (= "### Signature\n\n(Integer, String ...) => Anything\n\n\n\n\n"
(f.markdown/->markdown (f/sig :parameters [(f/int)] :rest-parameter (f/str)))))

(is (= "# `Foo`\n\n### Signature\n\n() => Anything\n\n### Description\n\nThe Foo.\n\n\n"
(is (= "# `Foo`\n\n### Description\n\nThe Foo.\n\n### Signature\n\n() => Anything\n\n\n"
(f.markdown/->markdown (f/sig :name "Foo"
:description "The Foo."
:parameters [])))))

0 comments on commit f92c65b

Please sign in to comment.