Skip to content

Commit

Permalink
Merge commit 'origin/master'
Browse files Browse the repository at this point in the history
Conflicts:
	src/parser/grammar.pg
  • Loading branch information
joeri committed Aug 19, 2009
2 parents 686f030 + 66a059a commit c87038c
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 22 deletions.
38 changes: 34 additions & 4 deletions Rakefile
@@ -1,3 +1,16 @@
require 'rake/classic_namespace'
require 'rake/clean'

CLEAN.include('gen_*.pir')
CLEAN.include('*/gen_*.pir')
CLEAN.include('*/*/gen_*.pir')
CLEAN.include('Test.pir')
CLEAN.include('build.yaml')
CLEAN.include('*.c')
CLEAN.include('*.o')
CLOBBER.include('cardinal')
CLOBBER.include('*.pbc')

DEBUG = ENV['debug'] || false
ALTERNATIVE_RUBY = ENV['test_with'] || false
CONFIG = {}
Expand Down Expand Up @@ -75,11 +88,14 @@ def test(file, name="")
end
else
file "t/#{pir_file}" => [:config, "t/#{file}", "src/gen_actions.pir", "src/gen_grammar.pir"] do
unless File.exists?('cardinal.pbc')
Task['cardinal.pbc'].invoke
end
parrot("t/#{file}", "t/#{pir_file}", "cardinal.pbc", "pir")
end
puts "named #{name}" if DEBUG
task name => [:config, "t/#{pir_file}", "cardinal.pbc", "Test.pir"] do
run_test pir_file, name
task name => [:config, "t/#{pir_file}", "cardinal.pbc", "Test.pir"] do |t|
run_test pir_file, "#{t.scope.join(':')}:#{name}"
end
end
end
Expand Down Expand Up @@ -153,10 +169,11 @@ def run_test(file,name="")
result = "Complete failure... no plan given"
$failures += 1
end
puts "Running test #{name} #{result}"
puts "Running #{name} #{result}"
end
end

desc "Determine configuration information"
task :config => "build.yaml" do
require 'yaml'
File.open("build.yaml","r") do |f|
Expand Down Expand Up @@ -187,6 +204,7 @@ file "build.yaml" do
end
end

desc "Make the cardinal binary."
file "cardinal" => [:config, "cardinal.pbc"] do
make_exe("cardinal.pbc")
end
Expand Down Expand Up @@ -292,6 +310,7 @@ namespace :test do |ns|
test "array/values_at.t"
test "array/warray.t"

desc "Run tests on Array."
task :all => [:array, :assign, :at, :clear, :collect, :compact, :concat, :delete, :empty, :equals, :fetch, :fill, :first, :flatten, :grep, :include, :index, :insert, :intersection, :join, :mathop, :nitems, :pop, :push, :reject, :replace, :reverse, :shift, :slice, :sort, :to_s, :uniq, :values_at, :warray]
end

Expand All @@ -300,13 +319,15 @@ namespace :test do |ns|
test "file/file.t"
test "file/stat.t"

desc "Run tests on File."
task :all => [:dir, :file, :stat]
end

namespace :hash do
test "hash/hash.t"
test "hash/exists.t"

desc "Run tests on Hash."
task :all => [:hash, :exists]
end

Expand All @@ -315,6 +336,7 @@ namespace :test do |ns|
test "integer/times.t"
test "integer/cmp.t"

desc "Run tests on Integer."
task :all => [:integer, :times, :cmp]
end

Expand All @@ -323,12 +345,14 @@ namespace :test do |ns|
test "kernel/open.t"
test "kernel/sprintf.t"

desc "Run tests on Kernel."
task :all => [:exit, :open, :sprintf]
end

namespace :math do
test "math/functions.t"

desc "Run tests on Math."
task :all => [:functions]
end

Expand All @@ -342,6 +366,7 @@ namespace :test do |ns|
test "range/to_s.t"
test "range/tofrom-variants.t"

desc "Run tests on Range."
task :all => [:each, :infixexclusive, :infixinclusive, :membershipvariants, :new, :to_a, :to_s, :tofromvariants]
end

Expand All @@ -362,10 +387,14 @@ namespace :test do |ns|
test "string/reverse.t"
test "string/upcase.t"

desc "Run tests on String."
task :all => [:add, :block, :capitalize, :chops, :cmp, :concat, :downcase, :empty, :eq, :mult, :new, :quote, :random_access, :reverse, :upcase]
end

task :basic => [:sanity, :stmts, :functions, :return, :indexed, :opcmp, :loops, :class, :test, :regex, :slurpy, :gather, :other, :alias, :assignment, :blocks, :constants, :continuation, :freeze, :gc, :nil, :proc, :range, :splat, :time, :yield, :zip]
desc "Run basic tests."
task :basic => [:sanity, :stmts, :functions, :return, :indexed, :opcmp, :loops, :class, :test, :regex, :slurpy, :gather, :other, :alias, :assignment, :bool, :blocks, :constants, :continuation, :freeze, :gc, :nil, :proc, :range, :splat, :time, :yield, :zip]

desc "Run the entire test suite."
task :all => [:basic, "array:all", "file:all", "hash:all", "integer:all", "kernel:all", "math:all", "range:all", "string:all"] do
dur_seconds = Time.now.to_i - $start.to_i
dur_minutes = 0
Expand Down Expand Up @@ -426,6 +455,7 @@ namespace :test do |ns|
puts " -- CLEAN FOR COMMIT --" if clean?
end

desc "Run test:all *and* produce stats about known issues."
task :stats => [:all] do
$pl = $issue_counts.size > 1
unless $issue_counts.empty?
Expand Down
11 changes: 6 additions & 5 deletions build/Makefile.in
Expand Up @@ -48,14 +48,15 @@ BUILTINS_PIR = \
src/builtins/cmp.pir \
src/builtins/op.pir \
src/classes/Object.pir \
src/classes/Exception.pir \
src/classes/NilClass.pir \
src/classes/String.pir \
src/classes/Integer.pir \
src/classes/Array.pir \
src/classes/Hash.pir \
src/classes/Any.pir \
src/classes/Range.pir \
src/classes/Bool.pir \
src/classes/TrueClass.pir \
src/classes/FalseClass.pir \
src/classes/Kernel.pir \
src/classes/Time.pir \
src/classes/Math.pir \
Expand Down Expand Up @@ -132,13 +133,13 @@ help:
@echo ""

test: all
$(PERL) t/harness
rake test:all

arraytest: all
$(PERL) t/harness --tests-from-dir=array
rake test:array:all

hashtest: all
$(PERL) t/harness --tests-from-dir=hash
rake test:hash:all

# this target has nothing to do
testclean:
Expand Down
19 changes: 17 additions & 2 deletions src/builtins/cmp.pir
Expand Up @@ -45,20 +45,35 @@ Swiped from Rakudo.
.return ($P0)
.end

.sub 'infix:==' :multi(TrueClass,FalseClass)
.sub 'infix:==' :multi(TrueClass,_)
.param pmc a
.param pmc b
$P0 = get_hll_global 'false'
.return ($P0)
.end

.sub 'infix:==' :multi(FalseClass,TrueClass)
.sub 'infix:==' :multi(FalseClass,_)
.param pmc a
.param pmc b
$P0 = get_hll_global 'false'
.return ($P0)
.end

.sub 'infix:==' :multi(_,TrueClass)
.param pmc a
.param pmc b
$P0 = get_hll_global 'false'
.return ($P0)
.end

.sub 'infix:==' :multi(_,FalseClass)
.param pmc a
.param pmc b
$P0 = get_hll_global 'false'
.return ($P0)
.end


.sub 'infix:==' :multi(Integer,Integer)
.param pmc a
.param pmc b
Expand Down
12 changes: 4 additions & 8 deletions src/classes/GC.pir
Expand Up @@ -54,12 +54,10 @@ Perform initializations and create the GC class
$P1 = 1
setattribute self, '$!disabled', $P1
collectoff
$P0 = new 'CardinalString'
$P0 = 'false'
$P0 = get_hll_global 'false'
.return ($P0)
already_disabled:
$P0 = new 'CardinalString'
$P0 = 'true'
$P0 = get_hll_global 'true'
.return ($P0)
.end

Expand All @@ -68,16 +66,14 @@ Perform initializations and create the GC class
if $P0 == 1 goto enable
goto already_enabled
already_enabled:
$P0 = new 'CardinalString'
$P0 = 'false'
$P0 = get_hll_global 'false'
.return ($P0)
enable:
$P1 = new 'CardinalInteger'
$P1 = 0
setattribute self, '$!disabled', $P1
collecton
$P0 = new 'CardinalString'
$P0 = 'true'
$P0 = get_hll_global 'true'
.return ($P0)
.end

Expand Down
3 changes: 1 addition & 2 deletions src/parser/grammar.pg
Expand Up @@ -414,7 +414,7 @@ token literal {
}

token float {
'-'? \d* '.' \d+
'-'? \d+ '.' \d+
{*}
}

Expand Down Expand Up @@ -542,7 +542,6 @@ proto 'infix:/' is equiv('infix:*') { ... }
proto 'infix:%' is equiv('infix:*')
is pirop('mod') { ... }

#
#proto 'prefix:+' is tighter('infix:*') { ... }
#proto 'prefix:-' is equiv('prefix:+') { ... }
#proto 'prefix:!' is equiv('prefix:+') { ... }
Expand Down
9 changes: 8 additions & 1 deletion t/bool.t
@@ -1,8 +1,15 @@
require "Test"
include Test

plan 3
plan 10

is true, true, "true == true"
is false, false, "false == false"
isnt true, false, "true != false"
isnt true, 1, "true != 1"
isnt true, 0, "true != 0"
isnt false, 0, "false != 0"
isnt -1, false, "-1 != false"
isnt -1, true, "-1 != false"
isnt "", false, "empty string isn't false"
isnt "", true, "empty string isn't true"

0 comments on commit c87038c

Please sign in to comment.