Run lein ancient
and updated dependencies.
to_psql_tests do NOT yet pass (new file, never has passed)
This commit is contained in:
parent
481fb5f535
commit
dd4120bb91
|
@ -11,8 +11,8 @@
|
||||||
[environ "1.1.0"]
|
[environ "1.1.0"]
|
||||||
[hiccup "1.0.5"]
|
[hiccup "1.0.5"]
|
||||||
[org.clojure/clojure "1.8.0"]
|
[org.clojure/clojure "1.8.0"]
|
||||||
[org.clojure/math.combinatorics "0.1.4"]
|
[org.clojure/math.combinatorics "0.1.6"]
|
||||||
[org.clojure/tools.cli "0.3.7"]]
|
[org.clojure/tools.cli "0.4.2"]]
|
||||||
|
|
||||||
:aot [adl.main]
|
:aot [adl.main]
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@
|
||||||
(if
|
(if
|
||||||
(and
|
(and
|
||||||
(= (:tag property) :property)
|
(= (:tag property) :property)
|
||||||
(not (#{"link"} (:type (:attrs property)))))
|
(not (#{"link" "list£"} (:type (:attrs property)))))
|
||||||
(s/join
|
(s/join
|
||||||
" "
|
" "
|
||||||
(remove
|
(remove
|
||||||
|
|
73
test/adl/to_psql_test.clj
Normal file
73
test/adl/to_psql_test.clj
Normal file
|
@ -0,0 +1,73 @@
|
||||||
|
(ns adl.to-psql-test
|
||||||
|
(:require [clojure.string :as s]
|
||||||
|
[clojure.test :refer :all]
|
||||||
|
[adl.to-psql :refer :all]
|
||||||
|
[adl-support.utils :refer :all]))
|
||||||
|
|
||||||
|
(deftest create-table-test
|
||||||
|
(testing "Generation of table creation"
|
||||||
|
(let [application {:tag :application,
|
||||||
|
:attrs {:version "0.1.1", :name "test-app"},
|
||||||
|
:content
|
||||||
|
[{:tag :entity,
|
||||||
|
:attrs {:name "address"},
|
||||||
|
:content
|
||||||
|
[{:tag :key,
|
||||||
|
:attrs nil,
|
||||||
|
:content
|
||||||
|
[{:tag :property,
|
||||||
|
:attrs
|
||||||
|
{:immutable "true",
|
||||||
|
:required "true",
|
||||||
|
:distinct "system",
|
||||||
|
:type "integer",
|
||||||
|
:name "id"},
|
||||||
|
:content
|
||||||
|
[{:tag :generator, :attrs {:action "native"}, :content nil}]}
|
||||||
|
{:tag :property,
|
||||||
|
:attrs
|
||||||
|
{:immutable "true",
|
||||||
|
:required "true",
|
||||||
|
:distinct "all",
|
||||||
|
:generator "assigned"
|
||||||
|
:type "string",
|
||||||
|
:size "12"
|
||||||
|
:name "postcode"}}
|
||||||
|
]}
|
||||||
|
{:tag :property,
|
||||||
|
:attrs
|
||||||
|
{:distinct "user", :size "128", :type "string", :name "street"},
|
||||||
|
:content nil}
|
||||||
|
{:tag :property,
|
||||||
|
:attrs {:size "64", :type "string", :name "town"},
|
||||||
|
:content nil}
|
||||||
|
{:tag :property,
|
||||||
|
:attrs {:name "dwellings" :type "list" :entity "dwellings" :farkey "address_id"}}
|
||||||
|
]}
|
||||||
|
{:tag :entity,
|
||||||
|
:attrs {:name "dwelling"},
|
||||||
|
:content
|
||||||
|
[{:tag :key,
|
||||||
|
:attrs nil,
|
||||||
|
:content
|
||||||
|
[{:tag :property,
|
||||||
|
:attrs
|
||||||
|
{:immutable "true",
|
||||||
|
:required "true",
|
||||||
|
:distinct "system",
|
||||||
|
:type "integer",
|
||||||
|
:name "id"},
|
||||||
|
:content
|
||||||
|
[{:tag :generator, :attrs {:action "native"}, :content nil}]}]}
|
||||||
|
{:tag :property
|
||||||
|
:attrs
|
||||||
|
{:name "address_id" :required "true" :type "entity" :entity "address" :farkey "id"}}
|
||||||
|
{:tag :property
|
||||||
|
:attrs
|
||||||
|
{:name "sub_address" :type "string" :size "32"}}]}]}
|
||||||
|
address-entity (child-with-tag application :entity #(= (:name %) "address"))
|
||||||
|
dwelling-entity (child-with-tag application :entity #(= (:name %) "dwelling"))
|
||||||
|
expected ""
|
||||||
|
actual (emit-table address-entity application "Test doc")
|
||||||
|
]
|
||||||
|
(is (= actual expected)))))
|
Loading…
Reference in a new issue