emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
blob 47a11692d24af75a377e791ca64f6a8ce44512d0 2918 bytes (raw)
name: testing/lisp/test-ob-php.el 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
 
;;; test-ob-php.el --- tests for ob-php.el

;; Copyright (c) 2014 Josh Dukes
;; Authors: Josh Dukes

;; 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 <http://www.gnu.org/licenses/>.

;;; Code:
(unless (featurep 'ob-php)
  (signal 'missing-test-dependency "Support for PHP code blocks"))

(ert-deftest ob-php/assert ()
  (should t))

;;expand tests

(ert-deftest ob-php/hello-world ()
  "Hello world program."
  (org-test-at-id "39b75bdf-0f2a-4e7a-a03c-4c2bfa96bf60"
    (org-babel-next-src-block) 
    (should (equal "hello world" (org-babel-execute-src-block)))))

(ert-deftest ob-php/intreturn ()
  "return an int."
  (org-test-at-id "39b75bdf-0f2a-4e7a-a03c-4c2bfa96bf60"
    (org-babel-next-src-block 2) 
    (should (= 42 (org-babel-execute-src-block)))))

(ert-deftest ob-php/expandvar ()
  "expand with variables."
  (org-test-at-id "39b75bdf-0f2a-4e7a-a03c-4c2bfa96bf60"
    (org-babel-next-src-block 3) 
    (should (equal "1 bar" (org-babel-execute-src-block)))))

(ert-deftest ob-php/multiline ()
  "expand with variables."
  (org-test-at-id "39b75bdf-0f2a-4e7a-a03c-4c2bfa96bf60"
    (org-babel-next-src-block 4) 
    (should (equal '(("php!")("sucks!")) (org-babel-execute-src-block)))))

;; noexpand tests

(ert-deftest ob-php/external-block ()
  "outside php block, inside php block."
  (org-test-at-id "47f2043a-abc9-4059-92bf-5df939e6881b"
    (org-babel-next-src-block) 
    (should (equal '(("outside" "php")("inside" "php")) (org-babel-execute-src-block)))))

;;array tests

(ert-deftest ob-php/fromvar ()
  "get value from variable in an unexpanded block."
  (org-test-at-id "2472b4b4-6582-44ca-844d-6a8299dd728b"
    (org-babel-next-src-block)
    (should (equal '(("value:" "baz")("value:" "bar")) (org-babel-execute-src-block)))))

(ert-deftest ob-php/fromvarexpand ()
  "get value from variable in an expanded block."
  (org-test-at-id "2472b4b4-6582-44ca-844d-6a8299dd728b"
    (org-babel-next-src-block 2)
    (should (equal '(("value:" "baz")("value:" "bar")) (org-babel-execute-src-block)))))

(ert-deftest ob-php/fromtableexpand ()
  "get value from table in an expanded block."
  (org-test-at-id "2472b4b4-6582-44ca-844d-6a8299dd728b"
    (org-babel-next-src-block 3)
    (should (equal '(("value:" "a")("value:" "b")("value:" "c")("value:" "duck")) (org-babel-execute-src-block)))))



debug log:

solving 47a1169 ...
found 47a1169 in https://list.orgmode.org/orgmode/20150112121032.e352cf20e00a217e4bc8a956@neg9.org/

applying [1/1] https://list.orgmode.org/orgmode/20150112121032.e352cf20e00a217e4bc8a956@neg9.org/
diff --git a/testing/lisp/test-ob-php.el b/testing/lisp/test-ob-php.el
new file mode 100644
index 0000000..47a1169

1:39: trailing whitespace.
    (org-babel-next-src-block) 
1:45: trailing whitespace.
    (org-babel-next-src-block 2) 
1:51: trailing whitespace.
    (org-babel-next-src-block 3) 
1:57: trailing whitespace.
    (org-babel-next-src-block 4) 
1:65: trailing whitespace.
    (org-babel-next-src-block) 
Checking patch testing/lisp/test-ob-php.el...
Applied patch testing/lisp/test-ob-php.el cleanly.
warning: squelched 1 whitespace error
warning: 6 lines add whitespace errors.

index at:
100644 47a11692d24af75a377e791ca64f6a8ce44512d0	testing/lisp/test-ob-php.el

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).