passing some session tests, but still failing some tests

This commit is contained in:
Eric Schulte 2009-06-13 19:35:48 -07:00
parent 391f677fc7
commit 08f92aebe5
2 changed files with 87 additions and 45 deletions

View File

@ -70,6 +70,7 @@ specifying a var of the same value."
(defun org-babel-ruby-table-or-results (results)
"If the results look like a table, then convert them into an
Emacs-lisp table, otherwise return the results as a string."
(message "results are %s" results)
(org-babel-read
(if (string-match "^\\[.+\\]$" results)
(org-babel-read

View File

@ -1947,6 +1947,9 @@ As an example eval the following. Adding a line to test
[3, 4, 5]
#+end_src
#+resname: simple-ruby-array
| 3 | 4 | 5 |
#+srcname: ruby-array-test
#+begin_src ruby :var ar = simple-ruby-array :results silent
ar.first
@ -2010,43 +2013,50 @@ org-babel functionality.
of these tests may fail.
#+TBLNAME: org-babel-tests
| functionality | block | arg | expected | results | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------|
| basic evaluation | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------|
| emacs lisp | basic-elisp | | 5 | 5 | pass |
| shell | basic-shell | | 6 | 6 | pass |
| ruby | basic-ruby | | org-babel | org-babel | pass |
| python | basic-python | | hello world | hello world | pass |
| R | basic-R | | 13 | 13 | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------|
| tables | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------|
| emacs lisp | table-elisp | | 3 | 3 | pass |
| ruby | table-ruby | | 1-2-3 | 1-2-3 | pass |
| python | table-python | | 5 | 5 | pass |
| R | table-R | | 3.5 | 3.5 | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------|
| source block references | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------|
| all languages | chained-ref-last | | Array | Array | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------|
| source block functions | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------|
| emacs lisp | defun-fibb | | fibbd | fibbd | pass |
| run over | Fibonacci | 0 | 1 | 1 | pass |
| a | Fibonacci | 1 | 1 | 1 | pass |
| variety | Fibonacci | 2 | 2 | 2 | pass |
| of | Fibonacci | 3 | 3 | 3 | pass |
| different | Fibonacci | 4 | 5 | 5 | pass |
| arguments | Fibonacci | 5 | 8 | 8 | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------|
| bugs and tasks | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+------|
| simple ruby arrays | ruby-array-test | | 3 | 3 | pass |
| R number evaluation | bug-R-number-evaluation | | 2 | 2 | pass |
| multi-line ruby blocks | multi-line-ruby-test | | 2 | 2 | pass |
| forcing vector results | test-forced-vector-results | | Array | Array | pass |
| functionality | block | arg | expected | results | pass |
|-------------------------+----------------------------+-----+-------------+-------------+-------------------------------|
| basic evaluation | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+-------------------------------|
| emacs lisp | basic-elisp | | 5 | 5 | pass |
| shell | basic-shell | | 6 | 6 | pass |
| ruby | basic-ruby | | org-babel | org-babel | pass |
| python | basic-python | | hello world | hello world | pass |
| R | basic-R | | 13 | 13 | pass |
|-------------------------+----------------------------+-----+-------------+-------------+-------------------------------|
| tables | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+-------------------------------|
| emacs lisp | table-elisp | | 3 | 3 | pass |
| ruby | table-ruby | | 1-2-3 | 1-2-3 | pass |
| python | table-python | | 5 | 5 | pass |
| R | table-R | | 3.5 | 3.5 | pass |
|-------------------------+----------------------------+-----+-------------+-------------+-------------------------------|
| source block references | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+-------------------------------|
| all languages | chained-ref-last | | Array | Array | pass |
|-------------------------+----------------------------+-----+-------------+-------------+-------------------------------|
| source block functions | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+-------------------------------|
| emacs lisp | defun-fibb | | fibbd | fibbd | pass |
| run over | Fibonacci | 0 | 1 | 1 | pass |
| a | Fibonacci | 1 | 1 | 1 | pass |
| variety | Fibonacci | 2 | 2 | 2 | pass |
| of | Fibonacci | 3 | 3 | 3 | pass |
| different | Fibonacci | 4 | 5 | 5 | pass |
| arguments | Fibonacci | 5 | 8 | 8 | pass |
|-------------------------+----------------------------+-----+-------------+-------------+-------------------------------|
| bugs and tasks | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+-------------------------------|
| simple ruby arrays | ruby-array-test | | 3 | #ERROR | expected "3" but was "#ERROR" |
| R number evaluation | bug-R-number-evaluation | | 2 | 2 | pass |
| multi-line ruby blocks | multi-line-ruby-test | | 2 | 2 | pass |
| forcing vector results | test-forced-vector-results | | Array | Array | pass |
|-------------------------+----------------------------+-----+-------------+-------------+-------------------------------|
| sessions | | | | | pass |
|-------------------------+----------------------------+-----+-------------+-------------+-------------------------------|
| set ruby session | set-ruby-session-var | | :set | :set | pass |
| get from ruby session | get-ruby-session-var | | 3 | 3 | pass |
| set python session | set-python-session-var | | set | set | pass |
| get from python session | get-python-session-var | | 4 | 4 | pass |
#+TBLFM: $5='(if (= (length $3) 1) (progn (message (format "running %S" '(sbe $2 (n $3)))) (sbe $2 (n $3))) (sbe $2))::$6='(if (string= $4 $5) "pass" (format "expected %S but was %S" $4 $5))
** basic tests
@ -2164,7 +2174,7 @@ table.class.name
(fibbd n)
#+end_src
** sbe tests
** sbe tests (these don't seem to be working...)
Testing the insertion of results into org-mode tables.
#+srcname: multi-line-output
@ -2178,9 +2188,7 @@ even a third"
#+end_src
#+resname:
: the first line ends here
: and this is the second one
: return even a third
: the first line ends here\n\n\n and this is the second one\n\neven a third
#+srcname: multi-line-error
#+begin_src ruby :results replace
@ -2188,9 +2196,7 @@ raise "oh nooooooooooo"
#+end_src
#+resname:
: -:5: warning: parenthesize argument(s) for future version
: -:5:in `main': oh nooooooooooo (RuntimeError)
: from -:8
: oh nooooooooooo
| the first line ends here... | -:5: warning: parenthesize argument(s) for future version... |
#+TBLFM: $1='(sbe "multi-line-output")::$2='(sbe "multi-line-error")
@ -2207,6 +2213,41 @@ raise "oh nooooooooooo"
triv.class.name
#+end_src
** sessions
#+srcname: set-ruby-session-var
#+begin_src ruby :session rb-testing
var = [1, 2, 3]
:set
#+end_src
#+srcname: get-ruby-session-var
#+begin_src ruby :session rb-testing
var.size
#+end_src
#+srcname: set-python-session-var
#+begin_src python :session py-testing
var=4
'set'
#+end_src
#+srcname: get-python-session-var
#+begin_src python :session py-testing
var
#+end_src
#+srcname: set-R-session-var
#+begin_src R :session R-testing
a <- 5
'set'
#+end_src
#+srcname: get-R-session-var
#+begin_src R :session R-testing
a
#+end_src
* Sandbox
:PROPERTIES:
@ -2258,7 +2299,7 @@ of the source code block into an org table. It's using the classic
out...
1. evaluate [[file:lisp/org-babel-init.el]] to load org-babel and friends
2. evaluate the transpose definition =\C-c\C-c= on the beginning of
2. evaluate the transpose definition =\C-c\\C-c= on the beginning of
the source block
3. evaluate the next source code block, this should read in the table
because of the =:var table=previous=, then transpose the table, and