|
1 | 1 | (ns codes.clj.docs.extractor.adapters-test |
2 | 2 | (:require [clojure.test :refer [deftest is testing]] |
3 | 3 | [codes.clj.docs.extractor.adapters :as adapters] |
| 4 | + [codes.clj.docs.extractor.fixtures.analysis :as fixtures.analysis] |
4 | 5 | [matcher-combinators.test :refer [match?]])) |
5 | 6 |
|
6 | | -(def analysis-fixture |
7 | | - [{:project {:git/url "https://github.com/clojure/clojure" |
8 | | - :git/tag "clojure-1.11.1" |
9 | | - :git/sha "ce55092f2b2f5481d25cff6205470c1335760ef6" |
10 | | - :deps/manifest :pom |
11 | | - :deps/root "/Users/username/.gitlibs/libs/org.clojure/clojure/ce55092f2b2f5481d25cff6205470c1335760ef6" |
12 | | - :parents #{[]} |
13 | | - :paths ["/Users/username/.gitlibs/libs/org.clojure/clojure/ce55092f2b2f5481d25cff6205470c1335760ef6/src/main/java" |
14 | | - "/Users/username/.gitlibs/libs/org.clojure/clojure/ce55092f2b2f5481d25cff6205470c1335760ef6/src/main/clojure" |
15 | | - "/Users/username/.gitlibs/libs/org.clojure/clojure/ce55092f2b2f5481d25cff6205470c1335760ef6/src/resources" |
16 | | - "/Users/username/.gitlibs/libs/org.clojure/clojure/ce55092f2b2f5481d25cff6205470c1335760ef6/src/clj"] |
17 | | - :project-name "org.clojure/clojure"} |
18 | | - :libraries [{:end-row 39 |
19 | | - :meta {} |
20 | | - :name-end-col 19 |
21 | | - :name-end-row 37 |
22 | | - :name-row 37 |
23 | | - :added "1.2" |
24 | | - :name 'clojure.pprint |
25 | | - :author "Tom Faulhaber" |
26 | | - :filename "/Users/username/.gitlibs/libs/org.clojure/clojure/ce55092f2b2f5481d25cff6205470c1335760ef6/src/clj/clojure/pprint.clj" |
27 | | - :col 1 |
28 | | - :name-col 5 |
29 | | - :end-col 40 |
30 | | - :doc "A Pretty Printer for Clojure\n\nclojure.pprint implements a flexible system for printing structured data\nin a pleasing easy-to-understand format. Basic use of the pretty printer is \nsimple just call pprint instead of println. More advanced users can use \nthe building blocks provided to create custom output formats. \n\nOut of the box pprint supports a simple structured format for basic data \nand a specialized format for Clojure source code. More advanced formats \nincluding formats that don't look like Clojure data at all like XML and \nJSON can be rendered by creating custom dispatch functions. \n\nIn addition to the pprint function this module contains cl-format a text \nformatting function which is fully compatible with the format function in \nCommon Lisp. Because pretty printing directives are directly integrated with\ncl-format it supports very concise custom dispatch. It also provides\na more powerful alternative to Clojure's standard format function.\n\nSee documentation for pprint and cl-format for more information or \ncomplete documentation on the Clojure web site on GitHub." |
31 | | - :row 14}] |
32 | | - :definitions [{:end-row 109 |
33 | | - :meta {} |
34 | | - :name-end-col 30 |
35 | | - :name-end-row 109 |
36 | | - :name-row 109 |
37 | | - :ns 'clojure.pprint |
38 | | - :name 'format-simple-number |
39 | | - :defined-by 'clojure.core/declare |
40 | | - :filename "/Users/username/.gitlibs/libs/org.clojure/clojure/ce55092f2b2f5481d25cff6205470c1335760ef6/src/clj/clojure/pprint/pprint_base.clj" |
41 | | - :col 1 |
42 | | - :name-col 10 |
43 | | - :end-col 31 |
44 | | - :row 109} |
45 | | - {:end-row 327 |
46 | | - :meta {:arglists '[[options* body]]} |
47 | | - :name-end-col 31 |
48 | | - :name-end-row 302 |
49 | | - :name-row 302 |
50 | | - :added "1.2" |
51 | | - :ns 'clojure.pprint |
52 | | - :name 'pprint-logical-block |
53 | | - :defined-by 'clojure.core/defmacro |
54 | | - :filename "/Users/username/.gitlibs/libs/org.clojure/clojure/ce55092f2b2f5481d25cff6205470c1335760ef6/src/clj/clojure/pprint/pprint_base.clj" |
55 | | - :macro true |
56 | | - :col 1 |
57 | | - :name-col 11 |
58 | | - :end-col 16 |
59 | | - :arglist-strs ["[& args]"] |
60 | | - :varargs-min-arity 0 |
61 | | - :doc |
62 | | - "Execute the body as a pretty printing logical block with output to *out* which \nmust be a pretty printing writer. When used from pprint or cl-format this can be \nassumed. \n\nThis function is intended for use when writing custom dispatch functions.\n\nBefore the body the caller can optionally specify options: :prefix :per-line-prefix \nand :suffix." |
63 | | - :row 302} |
64 | | - {:fixed-arities #{1 2} |
65 | | - :end-row 35 |
66 | | - :meta {} |
67 | | - :name-end-col 18 |
68 | | - :name-end-row 11 |
69 | | - :name-row 11 |
70 | | - :added "1.3" |
71 | | - :ns 'clojure.pprint |
72 | | - :name 'print-table |
73 | | - :defined-by 'clojure.core/defn |
74 | | - :filename "/Users/username/.gitlibs/libs/org.clojure/clojure/ce55092f2b2f5481d25cff6205470c1335760ef6/src/clj/clojure/pprint/print_table.clj" |
75 | | - :col 1 |
76 | | - :name-col 7 |
77 | | - :end-col 51 |
78 | | - :arglist-strs ["[ks rows]" "[rows]"] |
79 | | - :doc "Prints a collection of maps in a textual table. Prints table headings\n ks and then a line of output for each row corresponding to the keys\n in ks. If ks are not specified use the keys of the first item in rows." |
80 | | - :row 11}]}]) |
81 | | - |
82 | 7 | (deftest analysis->projects-test |
83 | 8 | (testing "analysis -> project" |
84 | | - (is (match? [#:project{:name "org.clojure/clojure" |
85 | | - :group "org.clojure" |
86 | | - :artifact "clojure" |
87 | | - :paths ["/src/main/java" |
88 | | - "/src/main/clojure" |
89 | | - "/src/resources" |
90 | | - "/src/clj"] |
91 | | - :url "https://github.com/clojure/clojure" |
92 | | - :tag "clojure-1.11.1" |
93 | | - :sha "ce55092f2b2f5481d25cff6205470c1335760ef6" |
94 | | - :manifest :pom}] |
95 | | - (adapters/analysis->projects analysis-fixture))))) |
| 9 | + (is (match? fixtures.analysis/projects-adapted |
| 10 | + (adapters/analysis->projects fixtures.analysis/raw))))) |
96 | 11 |
|
97 | 12 | (deftest analysis->libraries-test |
98 | 13 | (testing "analysis -> libraries" |
99 | | - (is (match? [#:library{:project "org.clojure/clojure" |
100 | | - :artifact "clojure" |
101 | | - :name-end-col 19 |
102 | | - :added "1.2" |
103 | | - :group "org.clojure" |
104 | | - :end-col 40 |
105 | | - :end-row 39 |
106 | | - :git-source "https://github.com/clojure/clojure/blob/clojure-1.11.1/src/clj/clojure/pprint.clj#L14" |
107 | | - :name-row 37 |
108 | | - :meta {} |
109 | | - :row 14 |
110 | | - :name-col 5 |
111 | | - :author "Tom Faulhaber" |
112 | | - :col 1 |
113 | | - :name "clojure.pprint" |
114 | | - :doc "A Pretty Printer for Clojure\n\nclojure.pprint implements a flexible system for printing structured data\nin a pleasing easy-to-understand format. Basic use of the pretty printer is \nsimple just call pprint instead of println. More advanced users can use \nthe building blocks provided to create custom output formats. \n\nOut of the box pprint supports a simple structured format for basic data \nand a specialized format for Clojure source code. More advanced formats \nincluding formats that don't look like Clojure data at all like XML and \nJSON can be rendered by creating custom dispatch functions. \n\nIn addition to the pprint function this module contains cl-format a text \nformatting function which is fully compatible with the format function in \nCommon Lisp. Because pretty printing directives are directly integrated with\ncl-format it supports very concise custom dispatch. It also provides\na more powerful alternative to Clojure's standard format function.\n\nSee documentation for pprint and cl-format for more information or \ncomplete documentation on the Clojure web site on GitHub." |
115 | | - :name-end-row 37 |
116 | | - :filename "/src/clj/clojure/pprint.clj"}] |
117 | | - (adapters/analysis->libraries analysis-fixture))))) |
| 14 | + (is (match? fixtures.analysis/libraries-adapted |
| 15 | + (adapters/analysis->libraries fixtures.analysis/raw))))) |
118 | 16 |
|
119 | 17 | (deftest analysis->definitions-test |
120 | 18 | (testing "analysis -> definitions" |
121 | | - (is (match? [#:definition{:defined-by "clojure.core/defmacro" |
122 | | - :library "clojure.pprint" |
123 | | - :filename "/src/clj/clojure/pprint/pprint_base.clj" |
124 | | - :macro true |
125 | | - :project "org.clojure/clojure" |
126 | | - :row 302 |
127 | | - :varargs-min-arity 0 |
128 | | - :added "1.2" |
129 | | - :arglist-strs ["[& args]"] |
130 | | - :col 1 |
131 | | - :name-col 11 |
132 | | - :end-col 16 |
133 | | - :doc "Execute the body as a pretty printing logical block with output to *out* which \nmust be a pretty printing writer. When used from pprint or cl-format this can be \nassumed. \n\nThis function is intended for use when writing custom dispatch functions.\n\nBefore the body the caller can optionally specify options: :prefix :per-line-prefix \nand :suffix." |
134 | | - :git-source "https://github.com/clojure/clojure/blob/clojure-1.11.1/src/clj/clojure/pprint/pprint_base.clj#L302" |
135 | | - :name-end-row 302 |
136 | | - :name-row 302 |
137 | | - :group "org.clojure" |
138 | | - :meta {:arglists '[[options* body]]} |
139 | | - :artifact "clojure" |
140 | | - :name-end-col 31 |
141 | | - :end-row 327 |
142 | | - :name "pprint-logical-block"} |
143 | | - #:definition{:defined-by "clojure.core/defn" |
144 | | - :library "clojure.pprint" |
145 | | - :filename "/src/clj/clojure/pprint/print_table.clj" |
146 | | - :project "org.clojure/clojure" |
147 | | - :row 11 |
148 | | - :added "1.3" |
149 | | - :arglist-strs ["[ks rows]" "[rows]"] |
150 | | - :col 1 |
151 | | - :name-col 7 |
152 | | - :end-col 51 |
153 | | - :doc "Prints a collection of maps in a textual table. Prints table headings\n ks and then a line of output for each row corresponding to the keys\n in ks. If ks are not specified use the keys of the first item in rows." |
154 | | - :git-source "https://github.com/clojure/clojure/blob/clojure-1.11.1/src/clj/clojure/pprint/print_table.clj#L11" |
155 | | - :fixed-arities #{1 2} |
156 | | - :name-end-row 11 |
157 | | - :name-row 11 |
158 | | - :group "org.clojure" |
159 | | - :meta {} |
160 | | - :artifact "clojure" |
161 | | - :name-end-col 18 |
162 | | - :end-row 35 |
163 | | - :name "print-table"}] |
164 | | - (adapters/analysis->definitions analysis-fixture))))) |
| 19 | + (is (match? fixtures.analysis/definitions-adapted |
| 20 | + (adapters/analysis->definitions fixtures.analysis/raw))))) |
| 21 | + |
| 22 | +(deftest analysis->datoms-test |
| 23 | + (testing "analysis -> datoms" |
| 24 | + (is (= 4 |
| 25 | + (count (adapters/analysis->datoms fixtures.analysis/raw)))))) |
0 commit comments