|
Revision 164, 1.0 kB
(checked in by why, 4 years ago)
|
|
- tests/YTS.c.erb: Template for generating YTS tests in C.
- tests/YTS.c.rb: Script for generating YTS tests in C.
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 | # |
|---|
| 2 | # YTS.c.rb |
|---|
| 3 | # |
|---|
| 4 | # $Author$ |
|---|
| 5 | # $Date$ |
|---|
| 6 | # |
|---|
| 7 | # Copyright (C) 2004 why the lucky stiff |
|---|
| 8 | # |
|---|
| 9 | # This Ruby script generates the YTS suite for the |
|---|
| 10 | # Syck base lib. Basically, it searches ext/ruby/yts/ for |
|---|
| 11 | # tests with a 'syck' entry. |
|---|
| 12 | # |
|---|
| 13 | # To regenerate things yourself: |
|---|
| 14 | # |
|---|
| 15 | # ruby YTS.c.rb > YTS.c |
|---|
| 16 | # |
|---|
| 17 | # Oh and your Ruby must have YAML installed. |
|---|
| 18 | # |
|---|
| 19 | require 'erb' |
|---|
| 20 | require 'yaml' |
|---|
| 21 | |
|---|
| 22 | # Find the Syck directory. |
|---|
| 23 | yts_dir = "ext/ruby/yts/" |
|---|
| 24 | syck_dir = "" |
|---|
| 25 | while File.expand_path( syck_dir ) != "/" |
|---|
| 26 | break if File.directory?( syck_dir + yts_dir ) |
|---|
| 27 | syck_dir << "../" |
|---|
| 28 | end |
|---|
| 29 | yts_dir = syck_dir + yts_dir |
|---|
| 30 | abort "No YTS directory found" unless File.directory?( yts_dir ) |
|---|
| 31 | |
|---|
| 32 | # Load the YTS |
|---|
| 33 | syck_tests = [] |
|---|
| 34 | YAML::load( File.open( yts_dir + "index.yml" ) ).each do |yst| |
|---|
| 35 | ct = 0 |
|---|
| 36 | YAML.each_document( File.open( yts_dir + yst + ".yml" ) ) do |ydoc| |
|---|
| 37 | ydoc['group'] = yst |
|---|
| 38 | ydoc['func'] = "#{ ydoc['group'] }_#{ ct }" |
|---|
| 39 | syck_tests << ydoc if ydoc['syck'] |
|---|
| 40 | ct += 1 |
|---|
| 41 | end |
|---|
| 42 | end |
|---|
| 43 | |
|---|
| 44 | puts ERB.new( File.read( syck_dir + "tests/YTS.c.erb" ), 0, "%<>" ).result |
|---|