1 ;;; cedet-files-utests.el ---
3 ;; Copyright (C) 2011 Eric M. Ludlam
5 ;; Author: Eric M. Ludlam <eric@siege-engine.com>
7 ;; This program is free software; you can redistribute it and/or
8 ;; modify it under the terms of the GNU General Public License as
9 ;; published by the Free Software Foundation, either version 3 of the
10 ;; License, or (at your option) any later version.
12 ;; This program is distributed in the hope that it will be useful, but
13 ;; WITHOUT ANY WARRANTY; without even the implied warranty of
14 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 ;; General Public License for more details.
17 ;; You should have received a copy of the GNU General Public License
18 ;; along with this program. If not, see http://www.gnu.org/licenses/.
25 (require 'cedet-files
)
29 (defvar cedet-files-utest-list
31 ( "/home/me/src/myproj/src/foo.c" .
"!home!me!src!myproj!src!foo.c" )
32 ( "c:/work/myproj/foo.el" .
"!drive_c!work!myproj!foo.el" )
33 ( "//windows/proj/foo.java" .
"!!windows!proj!foo.java" )
34 ( "/home/me/proj!bang/foo.c" .
"!home!me!proj!!bang!foo.c" )
36 "List of different file names to test.
37 Each entry is a cons cell of ( FNAME . CONVERTED )
38 where FNAME is some file name, and CONVERTED is what it should be
41 (defun cedet-files-utest ()
42 "Test out some file name conversions."
46 (dolist (FT cedet-files-utest-list
)
50 (let ((dir->file
(cedet-directory-name-to-file-name (car FT
) t
))
51 (file->dir
(cedet-file-name-to-directory-name (cdr FT
) t
))
54 (unless (string= (cdr FT
) dir-
>file
)
55 (error "Failed: %d. Found: %S Wanted: %S"
56 idx dir-
>file
(cdr FT
))
59 (unless (string= file-
>dir
(car FT
))
60 (error "Failed: %d. Found: %S Wanted: %S"
61 idx file-
>dir
(car FT
))
66 (provide 'cedet-files-utests
)
68 ;;; cedet-files-utests.el ends here