Fix compiler warning due to missing function prototype.
[svn.git] / subversion / bindings / swig / ruby / test / greek_tree.rb
blobffafc5eb56be5d3d42fdf2faa21c574eae093b85
1 module SvnTestUtil
2   class Greek
3     TREE = [
4             #  relative path , contents(nil means directory)
5             ["iota"        , "This is the file 'iota'.\n"   ],
6             ["A"           , nil                            ],
7             ["A/mu"        , "This is the file 'mu'.\n"     ],
8             ["A/B"         , nil                            ],
9             ["A/B/lambda"  , "This is the file 'lambda'.\n" ],
10             ["A/B/E"       , nil                            ],
11             ["A/B/E/alpha" , "This is the file 'alpha'.\n"  ],
12             ["A/B/E/beta"  , "This is the file 'beta'.\n"   ],
13             ["A/B/F"       , nil                            ],
14             ["A/C"         , nil                            ],
15             ["A/D"         , nil                            ],
16             ["A/D/gamma"   , "This is the file 'gamma'.\n"  ],
17             ["A/D/G"       , nil                            ],
18             ["A/D/G/pi"    , "This is the file 'pi'.\n"     ],
19             ["A/D/G/rho"   , "This is the file 'rho'.\n"    ],
20             ["A/D/G/tau"   , "This is the file 'tau'.\n"    ],
21             ["A/D/H"       , nil                            ],
22             ["A/D/H/chi"   , "This is the file 'chi'.\n"    ],
23             ["A/D/H/psi"   , "This is the file 'psi'.\n"    ],
24             ["A/D/H/omega" , "This is the file 'omega'.\n"  ]
25            ]
27     TREE.each do |path, contents|
28       const_set(path.split("/").last.upcase, path)
29     end
31     def initialize(tmp_path, wc_path, repos_uri)
32       @tmp_path = tmp_path
33       @wc_path = wc_path
34       @repos_uri = repos_uri
35     end
37     def setup(context)
38       TREE.each do |path, contents|
39         entry = File.expand_path(File.join(@tmp_path, path))
40         if contents
41           File.open(entry, 'w') {|f| f.print(contents)}
42         else
43           FileUtils.mkdir(entry)
44         end
45       end
47       context.import(@tmp_path, @repos_uri)
48       context.update(@wc_path)
49     end
51     def path(greek)
52       File.join(@wc_path, resolve(greek))
53     end
55     def uri(greek)
56       "#{@repos_uri}/#{resolve(greek)}"
57     end
59     def resolve(greek)
60       self.class.const_get(greek.to_s.upcase)
61     end
62   end
63 end