~ubuntu-branches/ubuntu/edgy/swig1.3/edgy

« back to all changes in this revision

Viewing changes to Examples/ruby/mark_function/runme.rb

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:16:04 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205011604-ygx904it6413k3go
Tags: 1.3.27-1ubuntu1
Resynchronise with Debian again, for the new subversion packages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
require 'example'
 
2
 
 
3
# create a zoo
 
4
zoo = Example::Zoo.new
 
5
 
 
6
begin
 
7
  # Add in an couple of animals
 
8
  tiger1 = Example::Animal.new("tiger1")
 
9
  zoo.add_animal(tiger1)
 
10
  
 
11
  # unset variables to force gc
 
12
  tiger = nil
 
13
end
 
14
 
 
15
GC.start
 
16
 
 
17
#  Now get the tiger again
 
18
tiger2 = zoo.get_animal(0)
 
19
 
 
20
# Call a method to verify the animal is still valid and not gc'ed
 
21
if tiger2.get_name != "tiger1"
 
22
    raise RuntimeError, "Wrong animal name"
 
23
end