[svn:parrot] r43102 - in branches/context_unify3: . t/pmc
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Wed Dec 16 14:14:46 UTC 2009
Author: whiteknight
Date: Wed Dec 16 14:14:46 2009
New Revision: 43102
URL: https://trac.parrot.org/parrot/changeset/43102
Log:
remove t/pmc/context.t. We no longer have a Context PMC so tests for creatingo one are bad. Fold tests into t/pmc/callcontext.t, though some are commented out for now
Deleted:
branches/context_unify3/t/pmc/context.t
Modified:
branches/context_unify3/MANIFEST
branches/context_unify3/t/pmc/callcontext.t
Modified: branches/context_unify3/MANIFEST
==============================================================================
--- branches/context_unify3/MANIFEST Wed Dec 16 14:09:42 2009 (r43101)
+++ branches/context_unify3/MANIFEST Wed Dec 16 14:14:46 2009 (r43102)
@@ -1873,7 +1873,6 @@
t/pmc/codestring.t [test]
t/pmc/complex.t [test]
t/pmc/config.t [test]
-t/pmc/context.t [test]
t/pmc/continuation.t [test]
t/pmc/coroutine.t [test]
t/pmc/cpointer.t [test]
Modified: branches/context_unify3/t/pmc/callcontext.t
==============================================================================
--- branches/context_unify3/t/pmc/callcontext.t Wed Dec 16 14:09:42 2009 (r43101)
+++ branches/context_unify3/t/pmc/callcontext.t Wed Dec 16 14:14:46 2009 (r43102)
@@ -19,7 +19,7 @@
.sub 'main' :main
.include 'test_more.pir'
- plan(66)
+ plan(69)
test_instantiate()
test_get_set_attrs()
@@ -30,6 +30,12 @@
test_keyed_access()
test_exists()
test_clone()
+ test_backtrace()
+
+ #$P0 = get_hll_global ['Foo'], 'load'
+ #$P0()
+ #$P0 = new ['Foo']
+ #$P0.'test_inspect'() # 16 tests
.end
.sub 'test_instantiate'
@@ -296,6 +302,124 @@
is($N2, 3.14159, 'clone - named number cloned')
.end
+.sub 'test_backtrace'
+ .local pmc bt
+ bt = 'test_bt1'()
+ $I0 = defined bt
+ ok($I0, "Got Context.backtrace()")
+
+ # We should have more than 3 elements
+ $I0 = elements bt
+ $I1 = $I0 > 3
+ ok($I1, "... got enough elements")
+
+ # First one should be "test_bt2"
+ $P1 = shift bt
+ $P2 = $P1['sub']
+ is($P2, 'test_bt2', "... with correct first element")
+.end
+
+.sub 'test_bt1'
+ $P0 = 'test_bt2'()
+ .return ($P0)
+.end
+
+.sub 'test_bt2'
+ $P0 = getinterp
+ $P1 = $P0['context']
+ $P2 = $P1.'backtrace'()
+ .return ($P2)
+.end
+
+# Put test_inspect into Namespace, as method, with outer, etc.
+.namespace ['Foo']
+
+.sub 'load'
+ $P0 = newclass 'Foo'
+.end
+
+.sub 'test_inspect' :method :outer('load')
+ .include 'test_more.pir'
+
+ .local pmc ctx
+
+ # We need LexPad
+ .lex 'foo_ctx', ctx
+
+ $P0 = getinterp
+ ctx = $P0['context']
+ $I0 = defined ctx
+ ok($I0, "Got Context")
+
+ # Check current_sub first. Other tests relying on it
+ $P0 = ctx['current_sub']
+ is($P0, 'test_inspect', 'Got Context.current_sub')
+
+ $P0 = ctx['caller_ctx']
+ $I0 = isa $P0, 'Context'
+ ok($I0, 'Got Context.caller_ctx')
+ $P0 = $P0['current_sub']
+ is($P0, 'main', '... from proper Sub')
+
+ $P0 = ctx['outer_ctx']
+ $I0 = isa $P0, 'Context'
+ ok($I0, 'Got Context.outer_ctx')
+ $P0 = $P0['current_sub']
+ is($P0, 'load', '... from proper Sub')
+
+ $P0 = ctx['lex_pad']
+ $I0 = isa $P0, 'LexPad'
+ ok($I0, 'Got Context.lex_pad')
+ $P1 = $P0['foo_ctx']
+ $I0 = defined $P1
+ ok($I0, '... with proper content')
+
+ $P0 = ctx['current_cont']
+ $I0 = isa $P0, 'Continuation'
+ ok($I0, 'Got Context.current_cont')
+
+ $P0 = ctx['current_object']
+ $I0 = isa $P0, 'Foo'
+ ok($I0, 'Got Context.current_object')
+
+ $P0 = ctx['current_namespace']
+ ok($P0, 'Got Context.current_namespace')
+ $P1 = $P0['test_inspect']
+ is($P1, 'test_inspect', '... with proper content')
+
+ # Checking handlers
+ push_eh done
+ $P0 = ctx['handlers']
+ $I0 = elements $P0
+
+ push_eh cought
+ # Now we should have one more handler
+ $P0 = ctx['handlers']
+ $I1 = elements $P0
+ dec $I1
+ is($I0, $I1, 'Got Context.handlers')
+
+ # Check absurd fields
+ $I0 = 1
+ $P0 = ctx['world_domination']
+ $I0 = 0
+ cought:
+ pop_eh
+ ok($I0, "No world domination in this Context")
+
+ # Current HLL shouldn't be zero
+ $P0 = ctx['current_HLL']
+ $I0 = $P0
+ ok($I0, 'Got Context.current_HLL')
+
+ $P0 = ctx['current_hll']
+ ok($P0, 'FOO', 'Got Context.current_hll')
+
+ done:
+ pop_eh
+
+.end
+
# Local Variables:
# mode: pir
# fill-column: 100
Deleted: branches/context_unify3/t/pmc/context.t
==============================================================================
--- branches/context_unify3/t/pmc/context.t Wed Dec 16 14:14:46 2009 (r43101)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,168 +0,0 @@
-#! parrot
-# Copyright (C) 2009, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/context.t - test Context PMC
-
-=head1 SYNOPSIS
-
- % prove t/pmc/context.t
-
-=head1 DESCRIPTION
-
-Tests the Context PMC.
-
-TODO: Implement real tests when Context PMC will be migrated to use ATTRibutes.
-
-=cut
-
-.HLL 'FOO'
-
-.sub main :main
- .include 'test_more.pir'
-
- plan(19)
-
- test_new()
-
- $P0 = get_hll_global ['Foo'], 'load'
- $P0()
- $P0 = new ['Foo']
- $P0.'test_inspect'() # 16 tests
-
- test_backtrace() # 3 tests
-.end
-
-.sub 'test_new'
- $P0 = new ['Context']
- sweep 1
- ok(1, 'Instantiated .Context')
-.end
-
-# Put test_inspect into Namespace, as method, with outer, etc.
-.namespace ['Foo']
-
-.sub 'load'
- $P0 = newclass 'Foo'
-.end
-
-.sub 'test_inspect' :method :outer('load')
- .include 'test_more.pir'
-
- .local pmc ctx
-
- # We need LexPad
- .lex 'foo_ctx', ctx
-
- $P0 = getinterp
- ctx = $P0['context']
- $I0 = defined ctx
- ok($I0, "Got Context")
-
- # Check current_sub first. Other tests relying on it
- $P0 = ctx['current_sub']
- is($P0, 'test_inspect', 'Got Context.current_sub')
-
- $P0 = ctx['caller_ctx']
- $I0 = isa $P0, 'Context'
- ok($I0, 'Got Context.caller_ctx')
- $P0 = $P0['current_sub']
- is($P0, 'main', '... from proper Sub')
-
- $P0 = ctx['outer_ctx']
- $I0 = isa $P0, 'Context'
- ok($I0, 'Got Context.outer_ctx')
- $P0 = $P0['current_sub']
- is($P0, 'load', '... from proper Sub')
-
- $P0 = ctx['lex_pad']
- $I0 = isa $P0, 'LexPad'
- ok($I0, 'Got Context.lex_pad')
- $P1 = $P0['foo_ctx']
- $I0 = defined $P1
- ok($I0, '... with proper content')
-
- $P0 = ctx['current_cont']
- $I0 = isa $P0, 'Continuation'
- ok($I0, 'Got Context.current_cont')
-
- $P0 = ctx['current_object']
- $I0 = isa $P0, 'Foo'
- ok($I0, 'Got Context.current_object')
-
- $P0 = ctx['current_namespace']
- ok($P0, 'Got Context.current_namespace')
- $P1 = $P0['test_inspect']
- is($P1, 'test_inspect', '... with proper content')
-
- # Checking handlers
- push_eh done
- $P0 = ctx['handlers']
- $I0 = elements $P0
-
- push_eh cought
- # Now we should have one more handler
- $P0 = ctx['handlers']
- $I1 = elements $P0
- dec $I1
- is($I0, $I1, 'Got Context.handlers')
-
- # Check absurd fields
- $I0 = 1
- $P0 = ctx['world_domination']
- $I0 = 0
- cought:
- pop_eh
- ok($I0, "No world domination in this Context")
-
- # Current HLL shouldn't be zero
- $P0 = ctx['current_HLL']
- $I0 = $P0
- ok($I0, 'Got Context.current_HLL')
-
- $P0 = ctx['current_hll']
- ok($P0, 'FOO', 'Got Context.current_hll')
-
- done:
- pop_eh
-
-.end
-
-.namespace []
-
-.sub 'test_backtrace'
- .local pmc bt
- bt = 'test_bt1'()
- $I0 = defined bt
- ok($I0, "Got Context.backtrace()")
-
- # We should have more than 3 elements
- $I0 = elements bt
- $I1 = $I0 > 3
- ok($I1, "... got enough elements")
-
- # First one should be "test_bt2"
- $P1 = shift bt
- $P2 = $P1['sub']
- is($P2, 'test_bt2', "... with correct first element")
-.end
-
-.sub 'test_bt1'
- $P0 = 'test_bt2'()
- .return ($P0)
-.end
-
-.sub 'test_bt2'
- $P0 = getinterp
- $P1 = $P0['context']
- $P2 = $P1.'backtrace'()
- .return ($P2)
-.end
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
More information about the parrot-commits
mailing list