Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(508)

Side by Side Diff: net/ftp/ftp_util_unittest.cc

Issue 215058: Correctly talk to VMS servers (translate UNIX paths to VMS and vice versa). (Closed)
Patch Set: fixes Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/ftp/ftp_util.cc ('k') | net/net.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "net/ftp/ftp_util.h"
6
7 #include "base/basictypes.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace {
11
12 TEST(FtpUtilTest, UnixFilePathToVMS) {
13 const struct {
14 const char* input;
15 const char* expected_output;
16 } kTestCases[] = {
17 { "", "" },
18 { "/", "[]" },
19 { "/a", "a" },
20 { "/a/b", "a:[000000]b" },
21 { "/a/b/c", "a:[b]c" },
22 { "/a/b/c/d", "a:[b.c]d" },
23 { "/a/b/c/d/e", "a:[b.c.d]e" },
24 { "a", "a" },
25 { "a/b", "[.a]b" },
26 { "a/b/c", "[.a.b]c" },
27 { "a/b/c/d", "[.a.b.c]d" },
28 };
29 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
30 EXPECT_EQ(kTestCases[i].expected_output,
31 net::FtpUtil::UnixFilePathToVMS(kTestCases[i].input))
32 << kTestCases[i].input;
33 }
34 }
35
36 TEST(FtpUtilTest, UnixDirectoryPathToVMS) {
37 const struct {
38 const char* input;
39 const char* expected_output;
40 } kTestCases[] = {
41 { "", "" },
42 { "/", "" },
43 { "/a", "a:[000000]" },
44 { "/a/", "a:[000000]" },
45 { "/a/b", "a:[b]" },
46 { "/a/b/", "a:[b]" },
47 { "/a/b/c", "a:[b.c]" },
48 { "/a/b/c/", "a:[b.c]" },
49 { "/a/b/c/d", "a:[b.c.d]" },
50 { "/a/b/c/d/", "a:[b.c.d]" },
51 { "/a/b/c/d/e", "a:[b.c.d.e]" },
52 { "/a/b/c/d/e/", "a:[b.c.d.e]" },
53 { "a", "[.a]" },
54 { "a/", "[.a]" },
55 { "a/b", "[.a.b]" },
56 { "a/b/", "[.a.b]" },
57 { "a/b/c", "[.a.b.c]" },
58 { "a/b/c/", "[.a.b.c]" },
59 { "a/b/c/d", "[.a.b.c.d]" },
60 { "a/b/c/d/", "[.a.b.c.d]" },
61 };
62 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
63 EXPECT_EQ(kTestCases[i].expected_output,
64 net::FtpUtil::UnixDirectoryPathToVMS(kTestCases[i].input))
65 << kTestCases[i].input;
66 }
67 }
68
69 TEST(FtpUtilTest, VMSPathToUnix) {
70 const struct {
71 const char* input;
72 const char* expected_output;
73 } kTestCases[] = {
74 { "", "." },
75 { "[]", "/" },
76 { "a", "/a" },
77 { "a:[000000]", "/a" },
78 { "a:[000000]b", "/a/b" },
79 { "a:[b]", "/a/b" },
80 { "a:[b]c", "/a/b/c" },
81 { "a:[b.c]", "/a/b/c" },
82 { "a:[b.c]d", "/a/b/c/d" },
83 { "a:[b.c.d]", "/a/b/c/d" },
84 { "a:[b.c.d]e", "/a/b/c/d/e" },
85 { "a:[b.c.d.e]", "/a/b/c/d/e" },
86 { "[.a]", "a" },
87 { "[.a]b", "a/b" },
88 { "[.a.b]", "a/b" },
89 { "[.a.b]c", "a/b/c" },
90 { "[.a.b.c]", "a/b/c" },
91 { "[.a.b.c]d", "a/b/c/d" },
92 { "[.a.b.c.d]", "a/b/c/d" },
93 };
94 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTestCases); i++) {
95 EXPECT_EQ(kTestCases[i].expected_output,
96 net::FtpUtil::VMSPathToUnix(kTestCases[i].input))
97 << kTestCases[i].input;
98 }
99 }
100
101 } // namespace
OLDNEW
« no previous file with comments | « net/ftp/ftp_util.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698