ruby-ole 1.2.2 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,54 @@
1
+ #! /usr/bin/ruby
2
+
3
+ $: << File.dirname(__FILE__) + '/../lib'
4
+
5
+ require 'test/unit'
6
+ require 'ole/types'
7
+
8
+ class TestTypes < Test::Unit::TestCase
9
+ include Ole::Types
10
+
11
+ def test_lpwstr
12
+ # FIXME adhoc. the iconv-yness shouldn't be user's problem
13
+ assert_equal "t\000e\000s\000t\000", Lpwstr.dump('test')
14
+ str = Lpwstr.load "t\000e\000s\000t\000"
15
+ assert_equal 'test', str
16
+ assert_equal Lpwstr, str.class
17
+ end
18
+
19
+ # in actual fact the same code path would be used for systime i expect
20
+ def test_filetime
21
+ # for saving, we can use Date, Time, or DateTime.
22
+ assert_equal "\000\000\260\3077-\307\001", FileTime.dump(Time.gm(2007, 1, 1))
23
+ time = FileTime.load "\000\000\260\3077-\307\001"
24
+ assert_equal FileTime, time.class
25
+ assert_equal "2007-01-01T00:00:00+00:00", time.to_s
26
+ # note that if we'd used Time.local, instead of gm, we'd get a different value. eg
27
+ assert_equal "\000\370\331\336\r-\307\001", FileTime.dump(DateTime.parse('2007-01-01 00:00 +0500'))
28
+ # note that it still loads up as GMT, because there's no associated time zone.
29
+ # essentially, i'm storing and loading times as GMT. maybe i should add in conversion to local time
30
+ # zone when loading
31
+ assert_equal "2006-12-31T19:00:00+00:00", FileTime.load("\000\370\331\336\r-\307\001").to_s
32
+ # test loading a bogus time
33
+ assert_equal nil, FileTime.load(0.chr * 8)
34
+ # this used to be counted as an "unlikely time", and discarded. that has been removed
35
+ assert_equal "1700-01-01T00:00:00+00:00", FileTime.load(FileTime.dump(Date.new(1700, 1, 1))).to_s
36
+ end
37
+
38
+ def test_guid
39
+ assert_equal "\x29\x03\x02\x00\x80\x08\x07\x40\xc0\x01\x12\x34\x56\x78\x90\x46",
40
+ Clsid.dump('{00020329-0880-4007-c001-123456789046}')
41
+ assert_equal '#<Ole::Types::Clsid:{00020329-0880-4007-c001-123456789046}>',
42
+ Clsid.load("\x29\x03\x02\x00\x80\x08\x07\x40\xc0\x01\x12\x34\x56\x78\x90\x46").inspect
43
+ end
44
+
45
+ def test_variant
46
+ assert_equal "\x29\x03\x02\x00\x80\x08\x07\x40\xc0\x01\x12\x34\x56\x78\x90\x46",
47
+ Variant.dump(VT_CLSID, '{00020329-0880-4007-c001-123456789046}')
48
+ assert_equal "2006-12-31T19:00:00+00:00", Variant.load(VT_FILETIME, "\000\370\331\336\r-\307\001").to_s
49
+ data = Variant.load VT_DATE, 'blahblah'
50
+ assert_equal Data, data.class
51
+ assert_equal 'blahblah', Variant.dump(VT_DATE, 'blahblah')
52
+ end
53
+ end
54
+
metadata CHANGED
@@ -3,16 +3,16 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: ruby-ole
5
5
  version: !ruby/object:Gem::Version
6
- version: 1.2.2
7
- date: 2007-11-06 00:00:00 +11:00
6
+ version: 1.2.3
7
+ date: 2007-12-28 00:00:00 +11:00
8
8
  summary: Ruby OLE library.
9
9
  require_paths:
10
10
  - lib
11
11
  email: aquasync@gmail.com
12
12
  homepage: http://code.google.com/p/ruby-ole
13
- rubyforge_project:
13
+ rubyforge_project: ruby-ole
14
14
  description: A library for easy read/write access to OLE compound documents for Ruby.
15
- autorequire: ole/storage
15
+ autorequire:
16
16
  default_executable:
17
17
  bindir: bin
18
18
  has_rdoc: true
@@ -30,6 +30,7 @@ authors:
30
30
  - Charles Lowe
31
31
  files:
32
32
  - Rakefile
33
+ - ChangeLog
33
34
  - bin/oletool
34
35
  - lib/ole/ranges_io.rb
35
36
  - lib/ole/property_set.rb
@@ -38,15 +39,26 @@ files:
38
39
  - lib/ole/support.rb
39
40
  - lib/ole/storage.rb
40
41
  - lib/ole/base.rb
42
+ - test/test_property_set.rb
41
43
  - test/test_ranges_io.rb
44
+ - test/test_types.rb
45
+ - test/test_mbat.rb
42
46
  - test/test_support.rb
43
47
  - test/test_storage.rb
44
48
  - test/test_filesystem.rb
45
49
  - test/test_word_6.doc
46
50
  - test/test_word_95.doc
47
51
  - test/test_word_97.doc
48
- test_files: []
49
-
52
+ - test/oleWithDirs.ole
53
+ - test/test_SummaryInformation
54
+ test_files:
55
+ - test/test_property_set.rb
56
+ - test/test_ranges_io.rb
57
+ - test/test_types.rb
58
+ - test/test_mbat.rb
59
+ - test/test_support.rb
60
+ - test/test_storage.rb
61
+ - test/test_filesystem.rb
50
62
  rdoc_options:
51
63
  - --main
52
64
  - Ole::Storage