Skip to content

Commit

Permalink
Merge pull request #72 from Swirrl/rename-test-suite
Browse files Browse the repository at this point in the history
Rename test suite
  • Loading branch information
lkitching authored Feb 21, 2022
2 parents c1faf87 + 463eb2e commit adc95df
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 19 deletions.
6 changes: 5 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,8 @@

:build {:deps {io.github.seancorfield/build-clj
{:git/tag "v0.6.3" :git/sha "9b8e09b"}}
:ns-default build}}}
:ns-default build}

:gen-test-suite {:extra-deps {org.clojure/data.csv {:mvn/version "1.0.0"}}
:extra-paths ["test" "test/resources"]
:exec-fn csv2rdf.w3c-csvw-suite-test.gen/write-tests-file}}}
8 changes: 8 additions & 0 deletions doc/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ To run the tests:
$ clojure -T:build test
```

`csv2rdf` in addition to its own tests, also includes an extensive
test suite generated from the official W3C CSV Working Group test
suite. Tests generated by this command will be run by the above command.

To rebuild this suite you can run the command:

`clojure -X:gen-test-suite`

To build the command line application as an uberjar:

```
Expand Down
2 changes: 1 addition & 1 deletion test/csv2rdf/examples_test.clj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(ns csv2rdf.examples-test
(:require [clojure.test :as t]
[clojure.java.io :as io]
[csv2rdf.csvw-test.impl :as impl]))
[csv2rdf.w3c-csvw-suite-test.impl :as impl]))

;; See issue 47
;; Resolving template property URIs with values containing spaces should work
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
(ns csv2rdf.csvw-test
(:require [clojure.test :refer :all]
(ns csv2rdf.w3c-csvw-suite-test
"WARNING THIS FILE IS GENERATED DO NOT EDIT BY HAND.
Generated test cases from the official W3C CSV Working Group's
test suite.
See csv2rdf.csvw-test.gen/write-tests-file for more details"
(:require [clojure.test :refer [deftest is]]
[clojure.java.io :as io]
[csv2rdf.csvw-test.impl :refer :all]
[csv2rdf.w3c-csvw-suite-test.impl :refer [is-isomorphic? test-csv->rdf]]
[csv2rdf.test-common :refer [->TestHttpClient]]
[csv2rdf.csvw :as csvw]
[csv2rdf.http :as http]
[grafter-2.rdf4j.io :as gio])
(:import [java.net URI URL]))
(:import [java.net URI]))

(deftest
^
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
(ns csv2rdf.csvw-test.gen
(ns csv2rdf.w3c-csvw-suite-test.gen
(:require [clojure.data.csv :as csv]
[clojure.java.io :as io]
[clojure.string :as string]
[csv2rdf.http :as http]
[csv2rdf.csvw-test.impl :refer :all]
#_:clj-kondo/ignore [csv2rdf.http :as http]
#_:clj-kondo/ignore [csv2rdf.w3c-csvw-suite-test.impl
:refer
[is-isomorphic? test-csv->rdf]]
[clojure.pprint :as pp])
(:import [java.io File]
[java.net URI URL]))
Expand Down Expand Up @@ -264,18 +266,23 @@
`(~'is (~'= 0 (~'count ~'errors)) "Received errors but none was expected"))))))

(def ns-decl
'(ns csv2rdf.csvw-test
(:require [clojure.test :refer :all]
'(ns csv2rdf.w3c-csvw-suite-test
"WARNING THIS FILE IS GENERATED DO NOT EDIT BY HAND.
Generated test cases from the official W3C CSV Working Group's
test suite.
See csv2rdf.csvw-test.gen/write-tests-file for more details"
(:require [clojure.test :refer [deftest is]]
[clojure.java.io :as io]
[csv2rdf.csvw-test.impl :refer :all]
[csv2rdf.w3c-csvw-suite-test.impl :refer [is-isomorphic? test-csv->rdf]]
[csv2rdf.test-common :refer [->TestHttpClient]]
[csv2rdf.csvw :as csvw]
[csv2rdf.http :as http]
[grafter-2.rdf4j.io :as gio])
(:import [java.net URI URL])))
(:import [java.net URI])))

(defn write-tests-file []
(with-open [writer (io/writer (io/file "test/csv2rdf/csvw_test.clj"))]
(defn write-tests-file [{:keys [test-file] :or {test-file "test/csv2rdf/w3c_csvw_suite_test.clj"}}]
(with-open [writer (io/writer (io/file test-file))]
(binding [pp/*print-right-margin* 120
pp/*print-pprint-dispatch* pp/code-dispatch]
(pp/pprint ns-decl writer)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(ns csv2rdf.csvw-test.impl
(:require [grafter-2.rdf4j.io :as gio]
(ns csv2rdf.w3c-csvw-suite-test.impl
(:require [grafter-2.rdf4j.io :as gio]
[grafter-2.rdf4j.repository :as repo]
[csv2rdf.logging :as logging]
[csv2rdf.csvw :refer [csv->rdf->destination]])
Expand Down

0 comments on commit adc95df

Please sign in to comment.