Permalink
Browse files

made conformance test suite

  • Loading branch information...
1 parent 29b0c27 commit ed36f2c1d4da02374e014ab1af56dda30b84c14b @bcherry bcherry committed Sep 29, 2010
Showing with 7,788 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +65 −0 Rakefile
  3. +6,240 −0 lib/jquery-1.4.2.js
  4. +155 −0 lib/qunit.css
  5. +1,261 −0 lib/qunit.js
  6. +66 −0 test/test.html
View
@@ -0,0 +1 @@
+test/cases.js
View
@@ -0,0 +1,65 @@
+require 'rubygems'
+require 'yaml'
+require 'json'
+require 'date'
+require 'digest'
+
+
+
+def conformance_version(dir)
+ Dir[File.join(dir, '*')].inject(Digest::SHA1.new){|digest, file| digest.update(Digest::SHA1.file(file).hexdigest) }
+end
+
+namespace :test do
+ namespace :conformance do
+ desc "Update conformance testing data"
+ task :update do
+ puts "Updating conformance data ... "
+ system("git submodule init") || raise("Failed to init submodule")
+ system("git submodule update") || raise("Failed to update submodule")
+ puts "Updating conformance data ... DONE"
+ end
+
+ desc "Change conformance test data to the lastest version"
+ task :latest => ['conformance:update'] do
+ current_dir = File.dirname(__FILE__)
+ submodule_dir = File.join(File.dirname(__FILE__), "test", "twitter-text-conformance")
+ version_before = conformance_version(submodule_dir)
+ system("cd #{submodule_dir} && git pull origin master") || raise("Failed to pull submodule version")
+ system("cd #{current_dir}")
+ if conformance_version(submodule_dir) != version_before
+ system("cd #{current_dir} && git add #{submodule_dir}") || raise("Failed to add upgrade files")
+ system("git commit -m \"Upgraded to the latest conformance suite\" #{submodule_dir}") || raise("Failed to commit upgraded conformacne data")
+ puts "Upgraded conformance suite."
+ else
+ puts "No conformance suite changes."
+ end
+ end
+
+ desc "Prepare JS conformance test suite"
+ task :prepare do
+ test_files = ['autolink', 'extract', 'hit_highlighting']
+ r = {}
+
+ f = File.open(File.join(File.dirname(__FILE__), "test", "cases.js"), "w")
+ f.write("var cases = {};")
+
+ test_files.each do |test_file|
+ path = File.join(File.dirname(__FILE__), "test", "twitter-text-conformance", test_file + ".yml")
+ yml = YAML.load_file path
+ f.write("cases.#{test_file} = #{yml['tests'].to_json};")
+ end
+
+ f.close
+ end
+
+ desc "Run conformance test suite"
+ task :run do
+ #todo
+ end
+ end
+
+ desc "Run conformance test suite"
+ task :conformance => ['conformance:latest', 'conformance:prepare', 'conformance:run'] do
+ end
+end
Oops, something went wrong.

0 comments on commit ed36f2c

Please sign in to comment.