PageRenderTime 25ms CodeModel.GetById 19ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/test/lib/io/test_file_tools.e

http://github.com/tybor/Liberty
Specman e | 64 lines | 38 code | 5 blank | 21 comment | 1 complexity | ab90aff2290d0b8c46f6cfe8ad30f30a MD5 | raw file
 1-- This file is part of SmartEiffel The GNU Eiffel Compiler Tools and Libraries.
 2-- See the Copyright notice at the end of this file.
 3--
 4class TEST_FILE_TOOLS
 5
 6insert
 7   EIFFELTEST_TOOLS
 8
 9create {}
10   make
11
12feature {ANY}
13   file_tools: FILE_TOOLS
14
15   make
16      local
17         tfw: TEXT_FILE_WRITE; path: STRING; ft: FILE_TOOLS; s: INTEGER; bt1, bt2: TIME; tif: TIME_IN_FRENCH
18      do
19         path := "tmp657"
20         if (create {FILE_TOOLS}).is_readable(path) then
21            ft.delete(path)
22            assert(ft.last_delete_succeeded)
23         end
24         assert(not (create {FILE_TOOLS}).is_readable(path))
25         create tfw.connect_to(path)
26         tfw.disconnect
27         bt1 := file_tools.last_change_of(path)
28         assert((create {FILE_TOOLS}).is_readable(path))
29         assert(ft.is_empty(path))
30         ft.delete(path)
31         assert(ft.last_delete_succeeded)
32         assert(not (create {FILE_TOOLS}).is_readable(path))
33         create tfw.connect_to(path)
34         tfw.put_string("Hello")
35         tfw.disconnect
36         s := file_tools.size_of(path)
37         assert(s = 5)
38         bt2 := file_tools.last_change_of(path)
39         assert(bt1.is_equal(bt2))
40         ft.delete(path)
41         assert(ft.last_delete_succeeded)
42         create tif
43         tif.set_time(bt1)
44      end
45
46end -- class TEST_FILE_TOOLS
47--
48-- ------------------------------------------------------------------------------------------------------------------------------
49-- Copyright notice below. Please read.
50--
51-- SmartEiffel is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License,
52-- as published by the Free Software Foundation; either version 2, or (at your option) any later version.
53-- SmartEiffel is distributed in the hope that it will be useful but WITHOUT ANY WARRANTY; without even the implied warranty
54-- of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have
55-- received a copy of the GNU General Public License along with SmartEiffel; see the file COPYING. If not, write to the Free
56-- Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
57--
58-- Copyright(C) 1994-2002: INRIA - LORIA (INRIA Lorraine) - ESIAL U.H.P.       - University of Nancy 1 - FRANCE
59-- Copyright(C) 2003-2006: INRIA - LORIA (INRIA Lorraine) - I.U.T. Charlemagne - University of Nancy 2 - FRANCE
60--
61-- Authors: Dominique COLNET, Philippe RIBET, Cyril ADRIAN, Vincent CROIZIER, Frederic MERIZEN
62--
63-- http://SmartEiffel.loria.fr - SmartEiffel@loria.fr
64-- ------------------------------------------------------------------------------------------------------------------------------