Guest User

Untitled

a guest
Oct 8th, 2018
175
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. From b2bebe23fcb373104627c7d2698515b32dc9e5be Mon Sep 17 00:00:00 2001
  2. From: Francois Perrad <francois.perrad@gadz.org>
  3. Date: Tue, 8 May 2012 10:36:49 +0200
  4. Subject: [PATCH] skip tests when the luasql driver is missing
  5.  
  6. ---
  7. tests/tdado.lua | 5 +++++
  8. tests/tdbobj.lua | 7 ++++++-
  9. 2 files changed, 11 insertions(+), 1 deletions(-)
  10.  
  11. diff --git a/tests/tdado.lua b/tests/tdado.lua
  12. index 69163eb..ec32fa8 100755
  13. --- a/tests/tdado.lua
  14. +++ b/tests/tdado.lua
  15. @@ -6,6 +6,11 @@ local user = arg[2]
  16. local pass = arg[3]
  17. local driver = arg[4] or "postgres"
  18.  
  19. +if not pcall(require, "luasql."..driver) then
  20. + print(" Skipped. No luasql." .. driver)
  21. + return
  22. +end
  23. +
  24. db = dado.connect (dbname, user, pass, driver)
  25. assert (type(db) == "table", "Nao consegui criar a conexao")
  26. assert (type(db.conn) == "userdata")
  27. diff --git a/tests/tdbobj.lua b/tests/tdbobj.lua
  28. index 4b5e3e5..f6e8d08 100755
  29. --- a/tests/tdbobj.lua
  30. +++ b/tests/tdbobj.lua
  31. @@ -5,7 +5,12 @@ local dado = require"dado"
  32. local dbname = arg[1] or "luasql-test"
  33. local user = arg[2]
  34. local pass = arg[3]
  35. -local driver = arg[4]
  36. +local driver = arg[4] or "postgres"
  37. +
  38. +if not pcall(require, "luasql."..driver) then
  39. + print(" Skipped. No luasql." .. driver)
  40. + return
  41. +end
  42.  
  43. local db = assert (dado.connect (dbname, user, pass, driver))
  44.  
  45. --
  46. 1.7.5.4
Add Comment
Please, Sign In to add comment