# Ruby Treasures 0.2
# Copyright (C) 2002 Paul Brannan <paul@atdesk.com>
# 
# You may distribute this software under the same terms as Ruby (see the file
# COPYING that was distributed with this library).
# 
require 'ds_test_helpers'
require 'hacks/private_instance_vars.rb'

class Foo
  private_instance_var :foo

  def initialize(x)
    set_piv :foo, x
  end

  def bar
    get_piv :foo
  end
end

class PrivateClassVarsTest < RUNIT::TestCase
  def test_simple
    f = Foo.new(42)
    assert_equal 42, f.bar
    assert_exception(NameError) do
      f.foo
    end
  end
end

exit run_test(PrivateClassVarsTest)

