**** Merged from MCS ****
[mono-project.git] / mcs / class / Microsoft.VisualBasic / Test / standalone / 6988.vb
blob39f514123ea6b6d0b6fe1403d4dd146a206bcc35
2 ' Copyright (c) 2002-2003 Mainsoft Corporation.
4 ' Permission is hereby granted, free of charge, to any person obtaining a
5 ' copy of this software and associated documentation files (the "Software"),
6 ' to deal in the Software without restriction, including without limitation
7 ' the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 ' and/or sell copies of the Software, and to permit persons to whom the
9 ' Software is furnished to do so, subject to the following conditions:
11 ' The above copyright notice and this permission notice shall be included in
12 ' all copies or substantial portions of the Software.
14 ' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 ' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 ' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 ' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 ' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 ' FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 ' DEALINGS IN THE SOFTWARE.
24 Imports Microsoft.VisualBasic
26 Public Class TestClass
27 Public Function Test() As String
28 Dim fn As Integer
29 Dim strOut As String
31 Dim strFileName As String
32 Dim strPathName As String
34 '// make sure all files are closed
35 Microsoft.VisualBasic.FileSystem.Reset()
38 strPathName = System.IO.Directory.GetCurrentDirectory() + "\data\"
39 strFileName = "6988.txt"
41 'if this file exists - kill it
42 If (strFileName = Dir(strPathName & strFileName)) Then
43 Kill(strPathName & strFileName)
44 End If
46 ' Write text to file.
47 fn = FreeFile()
48 FileOpen(fn, strPathName & strFileName, OpenMode.Output)
49 Write(fn, ",") ' Delimiting comma
50 Write(fn, "") ' blank line
51 Write(fn, "#NULL#") ' DBNull
52 Write(fn, "#TRUE#") ' True
53 Write(fn, "#FALSE#") ' False
54 ' #yyyy-mm-dd hh:mm:ss#
55 ' The date and/or time represented by the expression
56 Write(fn, "#1931-12-30 12:59:59#")
57 Write(fn, "#2000-01-01 12:00:00#")
58 ' #ERROR errornumber#
59 ' errornumber (variable is an object tagged as an error)
60 Write(fn, "#ERROR 52#")
61 FileClose(fn)
62 ' Input text from a file. Dim strIn As String Dim objIn As Object Dim b1 As Boolean Dim b2 As Boolean Dim d1 As Date Dim d2 As Date Dim ierr1 As Integer fn = FreeFile()
63 FileOpen(fn, strPathName & strFileName, OpenMode.Input)
64 Input(fn, strIn)
65 If strIn <> "," Then Return "failed to input Delimiting comma"
66 Input(fn, strIn)
67 If strIn <> "" Then Return "failed to input blank line"
69 Input(fn, strIn)
70 If strIn <> "#NULL#" Then Return "failed to input DBNull"
71 Input(fn, b1)
72 If b1 <> True Then Return "failed to input Boolean"
73 Input(fn, b2)
74 If b2 <> False Then Return "failed to input Boolean"
75 Input(fn, d1)
76 If d1 <> CDate("#1931-12-30 12:59:59#") Then Return "failed to input first Date"
77 Input(fn, d2)
78 If d2 <> CDate("#2000-01-01 12:00:00#") Then Return "failed to input second Date"
79 Input(fn, strIn)
80 If strIn <> "#ERROR 52#" Then Return "failed to input Error Number"
81 FileClose(fn)
83 Return "success"
85 End Function
86 End Class