[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
using previous =#+results= when =:eval never=
From: |
Greg Minshall |
Subject: |
using previous =#+results= when =:eval never= |
Date: |
Sat, 03 Jul 2021 19:35:29 +0300 |
hi.
i am trying to simplify adding regression test cases to a program.
to generate the base, "compared-to" results, i want to write some code
in a source block, then evaluate it, producing the "true" value.
then, later during development, i want to check if the code that ran in
that block gives the same results. to do this, i preface the test check
block with, e.g., =:var fu=bar=. obviously, i do *not* want to
re-create the base results; so, after producing the base case results, i
tried marking the source block that produces the results =:eval never=.
but, doing that, using `:var fu=bar` on a test check source block, fu's
value is nil. (*)
is there a way to convince org-mode to, in the face of =:eval never=, go
ahead and pass the *previous* results? or, some other idea of how to do
this? there will be a large number of these test cases.
cheers, Greg
(*) this is sort of confusing, so here's an example:
#+begin_src org
,#+name: testcountsdecompose
,#+begin_src R :eval never
mtcars[1:3,]
,#+end_src
,#+RESULTS: testcountsdecompose
| 21 | 6 | 160 | 110 | 3.9 | 2.62 | 16.46 | 0 | 1 | 4 | 4 |
| 21 | 6 | 160 | 110 | 3.9 | 2.875 | 17.02 | 0 | 1 | 4 | 4 |
| 22.8 | 4 | 108 | 93 | 3.85 | 2.32 | 18.61 | 1 | 1 | 4 | 1 |
,#+name: testcounts
,#+header: :var testcountsdecompose=testcountsdecompose :results output
,#+begin_src R
str(testcountsdecompose)
,#+end_src
,#+RESULTS: testcounts
: chr "nil"
#+end_src
whereas, if the =testcountsdecompose= source block does *not* have
=:eval never=, my =testcountsdecompse= variable has all the rows and
columns i was hoping for.
- using previous =#+results= when =:eval never=,
Greg Minshall <=