Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

forgotten files

  • Loading branch information...
commit ec761e7ea2fef8817c53f4920a123a0b0c522a88 1 parent bd0b79e
@romand authored
View
5 test/Gemfile
@@ -0,0 +1,5 @@
+source 'http://rubygems.org'
+
+gem 'iron_worker_ng'
+gem 'typhoeus'
+gem 'pry'
View
45 test/Rakefile
@@ -0,0 +1,45 @@
+require 'rake/testtask'
+require 'tmpdir'
+
+Dir.chdir(File.dirname(__FILE__) + '/..')
+
+Rake::TestTask.new do |t|
+ examples_tests_dir = Dir.mktmpdir('iw_examples')
+
+ FileUtils::cp_r(Dir.glob('examples/*'), examples_tests_dir)
+
+ Dir.glob('examples/**/**.rb').each do |path|
+ next unless path =~ %r|examples/(.*)/([^/]+)/\2.rb$|
+
+ dir = $1
+ name = $2
+
+ test_path = examples_tests_dir + "/#{dir}/#{name}/test_example_#{name}.rb"
+
+ File.open(test_path, 'w') do |out|
+ out << "require 'helpers'\n"
+ out << "class #{name.capitalize}Test < Test::Unit::TestCase\n"
+ out << "def test_example\n"
+
+ File.readlines(path).each do |line|
+ line, assert_str = line.chomp.split /#>/
+ out << line << "\n"
+
+ if assert_str
+ cond, desc = assert_str.split /--/
+ out << "assert(" << cond << ", '" <<
+ (desc or "").gsub(/'/, "\\\\'") << "')\n"
+ end
+ end
+
+ out << "end\nend\n"
+ end
+ end
+
+ t.libs << "lib" << "test" << examples_tests_dir
+ files = FileList['test/**/**.rb',
+ examples_tests_dir + '/**/test_*.rb']
+ t.test_files = files.keep_if{ |f| f =~ Regexp.new(ENV['TESTP'] || '') }
+
+ t.verbose = true
+end
View
1  test/data/dir1/dir2
View
0  test/data/dir2/test
No changes.
View
17 test/test_common_features.rb
@@ -0,0 +1,17 @@
+require 'helpers'
+require 'zip/zip'
+
+class CommonFeaturesTest < IWNGTest
+
+ def test_merge_file
+ code = code_bundle('test') do
+ merge_file('test', 'test/data/dir2')
+ merge_worker('test/hello.rb')
+ end
+
+ Zip::ZipFile.open(code.create_zip) do |zip|
+ assert zip.find_entry('test/data/dir2/test')
+ end
+ end
+
+end
Please sign in to comment.
Something went wrong with that request. Please try again.