Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ build:
test:
eask compile
eask emacs --batch -L . -L test -l test/all-tests.el -f ert-run-tests-batch-and-exit

test-one TEST_NAME:
eask compile
eask emacs --batch -L . -L test -l test/all-tests.el -eval '(ert-run-tests-batch-and-exit "{{TEST_NAME}}")'
2 changes: 1 addition & 1 deletion rustic-babel.el
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ Use VERSION, FEATURES and PATH."
(cdr crate-and-version)
"*"))
(features (cdr (assoc name crate-features)))
(path (cdr (assoc name crate-paths))))
(path (cadr (assoc name crate-paths))))

;; make sure it works with symbols and strings
(when (symbolp name)
Expand Down
18 changes: 18 additions & 0 deletions test/rustic-babel-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,22 @@
(rustic-test-babel-execute-block buf)
(should (string-equal (rustic-test-babel-check-results buf) "[[\"A\", \"B\"], [\"C\", \"D\"]]\n")))))

(ert-deftest rustic-test-babel-block-with-paths ()
(let* ((current-test-dir (or (and load-file-name (file-name-directory load-file-name))
(and buffer-file-name (file-name-directory buffer-file-name))
default-directory)) ; Fallback to `default-directory`
(string "use foo;
use bar;
fn main() {
foo::foo();
bar::bar();
}")
(params (format ":paths '((foo \"%s/test-project/crates/foo\") (bar \"%s/test-project/crates/bar\")) :crates '((foo . 0.0.1) (bar . 0.0.1))"
(expand-file-name "test" current-test-dir) (expand-file-name "test" current-test-dir)))
(buf (rustic-test-get-babel-block string params)))
(with-current-buffer buf
(rustic-test-babel-execute-block buf)
(should (eq (rustic-test-babel-check-results buf) nil)))))


(provide 'rustic-babel-test)
3 changes: 3 additions & 0 deletions test/test-project/crates/bar/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[package]
name = "bar"
version = "0.0.1"
3 changes: 3 additions & 0 deletions test/test-project/crates/bar/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn bar() {
()
}
3 changes: 3 additions & 0 deletions test/test-project/crates/foo/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[package]
name = "foo"
version = "0.0.1"
3 changes: 3 additions & 0 deletions test/test-project/crates/foo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
pub fn foo() {
()
}
Loading