Hi Eric,

Eric Schulte wrote:
> Thanks for working on this test, I look forward to adding it once it is
> completed.

As promised, a patch for checking that vars with no default value will
generate an error with a full explanation.

I edited 2 files:
- lisp/test-ob.el
- examples/babel.org

Tell me if this is following your expected way of receiving patches. I believe
so, but tell me anything that would not have been done correctly...

Best regards,
  Seb

-- 
Sebastien Vauban
>From 453c0d5e54544ef5812098817746b4280375f5e4 Mon Sep 17 00:00:00 2001
From: Sebastien Vauban <s...@mygooglest.com>
Date: Fri, 16 Sep 2011 12:06:21 +0200
Subject: [PATCH] Add test checking that any variable declared with no default
 value will generate a proper error message.

---
 testing/lisp/test-ob.el |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/testing/lisp/test-ob.el b/testing/lisp/test-ob.el
index 2e71a59..f78ca98 100644
--- a/testing/lisp/test-ob.el
+++ b/testing/lisp/test-ob.el
@@ -1,6 +1,6 @@
 ;;; test-ob.el --- tests for ob.el
 
-;; Copyright (c) 2010 Eric Schulte
+;; Copyright (c) 2010, 2011 Eric Schulte
 ;; Authors: Eric Schulte, Martyn Jago
 
 ;; Released under the GNU General Public License version 3
@@ -421,6 +421,15 @@
       (next-result)
       (should (not (org-babel-in-example-or-verbatim))))))
 
+(ert-deftest test-org-babel/no-defaut-value-for-var ()
+  "Test that the absence of a default value for a variable DOES THROW
+  a proper error."
+  (org-test-at-id "f2df5ba6-75fa-4e6b-8441-65ed84963627"
+    (org-babel-next-src-block)
+    (let ((err
+	   (should-error (org-babel-execute-src-block) :type 'error)))
+      (should (equal '(error "variable \"x\" in block \"carre\" must be assigned a default value") err)))))
+
 (provide 'test-ob)
 
 ;;; test-ob ends here
-- 
1.7.5.1

>From 3e04371aa9a7afcacf5c26877328a829b8067830 Mon Sep 17 00:00:00 2001
From: Sebastien Vauban <s...@mygooglest.com>
Date: Fri, 16 Sep 2011 12:07:19 +0200
Subject: [PATCH] Add test checking that any variable declared with no default
 value will generate a proper error message.

---
 testing/examples/babel.org |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/testing/examples/babel.org b/testing/examples/babel.org
index b892124..82dd8ee 100644
--- a/testing/examples/babel.org
+++ b/testing/examples/babel.org
@@ -307,3 +307,16 @@ src_sh{echo 2} blocks on the src_emacs-lisp{"same"} line
 
 #+results:
 [[file:./cv.cls]]
+
+* no default value for vars
+  :PROPERTIES:
+  :ID:       f2df5ba6-75fa-4e6b-8441-65ed84963627
+  :END:
+
+There is no default value assigned to =x= variable. This is not permitted
+anymore.
+
+#+source: carre(x)
+#+begin_src python
+  return x*x
+#+end_src
-- 
1.7.5.1

Reply via email to