;;; test-ob-rust.el --- tests for ob-rust.el ;; Copyright (c) 2017 Andrés Saraos Luna ;; Authors: Andrés Saraos Luna ;; This file is not part of GNU Emacs. ;; This program is free software; you can redistribute it and/or modify ;; it under the terms of the GNU General Public License as published by ;; the Free Software Foundation, either version 3 of the License, or ;; (at your option) any later version. ;; This program is distributed in the hope that it will be useful, ;; but WITHOUT ANY WARRANTY; without even the implied warranty of ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;; GNU General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this program. If not, see . (ert-deftest ob-rust/simple () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-simple") (should (= 42 (org-babel-execute-src-block)))))) (ert-deftest ob-rust/main-wrapper () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-main-wrapper") (should (= 42 (org-babel-execute-src-block)))))) (ert-deftest ob-rust/var-integer () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-var-integer") (should (= 42 (org-babel-execute-src-block)))))) (ert-deftest ob-rust/var-float () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-var-float") (should (= 3.14 (org-babel-execute-src-block)))))) (ert-deftest ob-rust/var-char () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-var-char") (should (string= "x" (org-babel-execute-src-block)))))) (ert-deftest ob-rust/var-string () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-var-string") (should (string= "GOAT" (org-babel-execute-src-block)))))) (ert-deftest ob-rust/var-bool-true () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-var-bool-true") (should (= 42 (org-babel-execute-src-block)))))) (ert-deftest ob-rust/var-bool-false () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-var-bool-false") (should (= 42 (org-babel-execute-src-block)))))) (ert-deftest ob-rust/var-mutable () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-var-mutable") (should (= 42 (org-babel-execute-src-block)))))) (ert-deftest ob-rust/var-given-type () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-var-given-type") (should (= 42 (org-babel-execute-src-block)))))) (ert-deftest ob-rust/var-mutable-and-given-type () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-var-mutable-and-given-type") (should (= 42 (org-babel-execute-src-block)))))) (ert-deftest ob-rust/var-no-main-wrapper () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-var-no-main-wrapper") (should (= 42 (org-babel-execute-src-block)))))) (ert-deftest ob-rust/uses-and-command-line-arguments () (when (executable-find org-babel-rust-command) (with-temp-buffer (insert-file-contents "ob-rust-test.org") (org-babel-goto-named-src-block "test-uses-and-command-line-arguments") (should (equal '((1 . (2 . ("bonjour")))) (org-babel-execute-src-block))))))