about summary refs log tree commit homepage
path: root/projects/mongrel_service/tests/test_helpers.bas
diff options
context:
space:
mode:
Diffstat (limited to 'projects/mongrel_service/tests/test_helpers.bas')
-rw-r--r--projects/mongrel_service/tests/test_helpers.bas35
1 files changed, 35 insertions, 0 deletions
diff --git a/projects/mongrel_service/tests/test_helpers.bas b/projects/mongrel_service/tests/test_helpers.bas
new file mode 100644
index 0000000..c4647c0
--- /dev/null
+++ b/projects/mongrel_service/tests/test_helpers.bas
@@ -0,0 +1,35 @@
+'#--
+'# Copyright (c) 2006-2007 Luis Lavena, Multimedia systems
+'#
+'# This source code is released under the MIT License.
+'# See MIT-LICENSE file for details
+'#++
+
+#include once "testly.bi"
+#include once "test_helpers.bi"
+#include once "file.bi"
+
+'# Global Helpers
+function content_of_file(byref filename as string) as string
+    dim result as string
+    dim handle as integer
+    dim buffer as string
+    
+    result = ""
+    buffer = ""
+    
+    if (fileexists(filename) = true) then
+        handle = freefile
+        open filename for input as #handle
+        do while not (eof(handle))
+            input #handle, buffer
+            result += buffer
+            buffer = ""
+        loop
+        close #handle
+    else
+        result = ""
+    end if
+    
+    return result
+end function