|
44 | 44 | (defun build-script-crate-file (file-name)
|
45 | 45 | (expand-file-name file-name "tests/build-script-test"))
|
46 | 46 |
|
| 47 | +(defun cdrassoc (sym alist) (cdr (assoc sym alist))) |
| 48 | + |
47 | 49 | (describe
|
48 | 50 | "`flycheck-rust-find-cargo-target' associates"
|
49 | 51 |
|
50 | 52 | (it "'src/lib.rs' to the library target"
|
51 | 53 | (expect
|
52 |
| - (car (flycheck-rust-find-cargo-target (crate-file "src/lib.rs"))) |
| 54 | + (cdrassoc 'kind (flycheck-rust-find-cargo-target (crate-file "src/lib.rs"))) |
53 | 55 | :to-equal "lib"))
|
54 | 56 |
|
55 | 57 | (it "'src/a.rs' to the library target"
|
56 | 58 | (expect
|
57 |
| - (car (flycheck-rust-find-cargo-target (crate-file "src/a.rs"))) |
| 59 | + (cdrassoc 'kind (flycheck-rust-find-cargo-target (crate-file "src/a.rs"))) |
58 | 60 | :to-equal "lib"))
|
59 | 61 |
|
60 | 62 | (it "'src/main.rs' to the main binary target"
|
61 | 63 | (expect
|
62 | 64 | (flycheck-rust-find-cargo-target (crate-file "src/main.rs"))
|
63 |
| - :to-equal '("bin" . "test-crate"))) |
| 65 | + :to-equal '((kind . "bin") (name . "test-crate")))) |
64 | 66 |
|
65 | 67 | (it "'src/bin/a.rs' to the 'a' binary target"
|
66 | 68 | (expect
|
67 | 69 | (flycheck-rust-find-cargo-target (crate-file "src/bin/a.rs"))
|
68 |
| - :to-equal '("bin" . "a"))) |
| 70 | + :to-equal '((kind . "bin") (name . "a")))) |
69 | 71 |
|
70 | 72 | (it "'src/bin/b.rs' to the 'b' binary target"
|
71 | 73 | (expect
|
72 | 74 | (flycheck-rust-find-cargo-target (crate-file "src/bin/b.rs"))
|
73 |
| - :to-equal '("bin" . "b"))) |
| 75 | + :to-equal '((kind . "bin") (name . "b")))) |
74 | 76 |
|
75 | 77 | (it "'src/bin/support/mod.rs' to any binary target"
|
76 | 78 | (expect
|
77 | 79 | (flycheck-rust-find-cargo-target (crate-file "src/bin/support/mod.rs"))
|
78 |
| - :to-equal-one-of '("bin". "a") '("bin". "b"))) |
| 80 | + :to-equal-one-of |
| 81 | + '((kind . "bin") (name . "a")) |
| 82 | + '((kind . "bin") (name . "b")))) |
79 | 83 |
|
80 | 84 | (it "'tests/a.rs' to the 'a' test target"
|
81 | 85 | (expect
|
82 | 86 | (flycheck-rust-find-cargo-target (crate-file "tests/a.rs"))
|
83 |
| - :to-equal '("test" . "a"))) |
| 87 | + :to-equal '((kind . "test") (name . "a")))) |
84 | 88 |
|
85 | 89 | (it "'tests/support/mod.rs' to any test target"
|
86 | 90 | (expect
|
87 | 91 | (flycheck-rust-find-cargo-target (crate-file "tests/support/mod.rs"))
|
88 |
| - :to-equal-one-of '("test". "a") '("test". "b"))) |
| 92 | + :to-equal-one-of |
| 93 | + '((kind . "test") (name . "a")) |
| 94 | + '((kind . "test") (name . "b")))) |
89 | 95 |
|
90 | 96 | (it "'examples/a.rs' to the 'a' example target"
|
91 | 97 | (expect
|
92 | 98 | (flycheck-rust-find-cargo-target (crate-file "examples/a.rs"))
|
93 |
| - :to-equal '("example" . "a"))) |
| 99 | + :to-equal '((kind . "example") (name . "a")))) |
94 | 100 |
|
95 | 101 | (it "'examples/b.rs' to the 'b' example target"
|
96 | 102 | (expect
|
97 | 103 | (flycheck-rust-find-cargo-target (crate-file "examples/b.rs"))
|
98 |
| - :to-equal '("example" . "b"))) |
| 104 | + :to-equal '((kind . "example") (name . "b")))) |
99 | 105 |
|
100 | 106 | (it "'examples/support/mod.rs' to any example target"
|
101 | 107 | (expect
|
102 | 108 | (flycheck-rust-find-cargo-target (crate-file "examples/support/mod.rs"))
|
103 |
| - :to-equal-one-of '("example" . "a") '("example" . "b"))) |
| 109 | + :to-equal-one-of |
| 110 | + '((kind . "example") (name . "a")) |
| 111 | + '((kind . "example") (name . "b")))) |
104 | 112 |
|
105 | 113 | (it "'benches/a.rs' to the 'a' bench target"
|
106 | 114 | (expect
|
107 | 115 | (flycheck-rust-find-cargo-target (crate-file "benches/a.rs"))
|
108 |
| - :to-equal '("bench" . "a"))) |
| 116 | + :to-equal '((kind . "bench") (name . "a")))) |
109 | 117 |
|
110 | 118 | (it "'benches/b.rs' to the 'b' bench target"
|
111 | 119 | (expect
|
112 | 120 | (flycheck-rust-find-cargo-target (crate-file "benches/b.rs"))
|
113 |
| - :to-equal '("bench" . "b"))) |
| 121 | + :to-equal '((kind . "bench") (name . "b")))) |
114 | 122 |
|
115 | 123 | (it "'benches/support/mod.rs' to any bench target"
|
116 | 124 | (expect
|
117 | 125 | (flycheck-rust-find-cargo-target (crate-file "benches/support/mod.rs"))
|
118 |
| - :to-equal-one-of '("bench" . "a") '("bench" . "b"))) |
| 126 | + :to-equal-one-of |
| 127 | + '((kind . "bench") (name . "a")) |
| 128 | + '((kind . "bench") (name . "b")))) |
119 | 129 |
|
120 | 130 | (it "'src/lib.rs' to the library target (custom-lib-target)"
|
121 | 131 | (expect
|
122 | 132 | (car (flycheck-rust-find-cargo-target (lib-crate-file "src/lib.rs")))
|
123 |
| - :to-equal "lib")) |
| 133 | + :to-equal '(kind . "lib"))) |
124 | 134 |
|
125 | 135 | (it "'build.rs' to any target in the same workspace member (parent)"
|
126 | 136 | (expect
|
127 | 137 | (flycheck-rust-find-cargo-target (build-script-crate-file "build.rs"))
|
128 |
| - :to-equal (cons "bin" "build-script-test"))) |
| 138 | + :to-equal '((kind . "bin") (name . "build-script-test")))) |
129 | 139 |
|
130 | 140 | (it "'build.rs' to any target in the same workspace member (child)"
|
131 | 141 | (expect
|
132 | 142 | (flycheck-rust-find-cargo-target (build-script-crate-file "lib-test/build.rs"))
|
133 |
| - :to-equal (cons "lib" "lib-test"))) |
| 143 | + :to-equal '((kind . "lib") (name . "lib-test")))) |
134 | 144 | )
|
0 commit comments