dde 0.2.9 → 0.2.11
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.
- data/.document +5 -5
- data/.gitignore +21 -22
- data/LICENSE +20 -20
- data/README.rdoc +19 -19
- data/Rakefile +60 -60
- data/VERSION +1 -1
- data/bin/dde_main +32 -32
- data/dde.gemspec +99 -99
- data/doc/ddeml.d.txt +374 -374
- data/doc/types.txt +159 -159
- data/exp/exp_client.rb +44 -44
- data/exp/exp_dde_monitor.rb +18 -18
- data/exp/exp_dde_server.rb +36 -36
- data/exp/exp_lib.rb +38 -38
- data/exp/exp_server.rb +44 -44
- data/features/dde.feature +9 -9
- data/features/support/env.rb +4 -4
- data/lib/dde.rb +9 -9
- data/lib/dde/app.rb +91 -91
- data/lib/dde/client.rb +102 -102
- data/lib/dde/dde_string.rb +32 -32
- data/lib/dde/monitor.rb +93 -93
- data/lib/dde/server.rb +40 -40
- data/lib/dde/xl_server.rb +89 -89
- data/lib/dde/xl_table.rb +190 -190
- data/spec/dde/app_shared.rb +84 -84
- data/spec/dde/app_spec.rb +7 -7
- data/spec/dde/client_spec.rb +199 -199
- data/spec/dde/dde_string_spec.rb +39 -39
- data/spec/dde/monitor_spec.rb +33 -33
- data/spec/dde/server_shared.rb +91 -91
- data/spec/dde/server_spec.rb +36 -36
- data/spec/dde/xl_server_spec.rb +63 -63
- data/spec/dde/xl_table_spec.rb +50 -50
- data/spec/spec.opts +2 -2
- data/spec/spec_helper.rb +21 -25
- metadata +35 -18
data/spec/dde/app_spec.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/app_shared')
|
3
|
-
|
4
|
-
module
|
5
|
-
describe
|
6
|
-
it_should_behave_like "DDE App"
|
7
|
-
end
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/app_shared')
|
3
|
+
|
4
|
+
module DdeTest
|
5
|
+
describe Dde::App do
|
6
|
+
it_should_behave_like "DDE App"
|
7
|
+
end
|
8
8
|
end
|
data/spec/dde/client_spec.rb
CHANGED
@@ -1,200 +1,200 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/app_shared')
|
3
|
-
|
4
|
-
module
|
5
|
-
|
6
|
-
describe
|
7
|
-
before(:each){ @client =
|
8
|
-
after(:each){ @client.stop_dde if @client.dde_active?}
|
9
|
-
|
10
|
-
it_should_behave_like "DDE App"
|
11
|
-
|
12
|
-
it 'new without parameters creates Client but does not activate DDEML' do
|
13
|
-
@client.id.should == nil
|
14
|
-
@client.conversation.should == nil
|
15
|
-
@client.service.should == nil
|
16
|
-
@client.topic.should == nil
|
17
|
-
@client.dde_active?.should == false
|
18
|
-
@client.conversation_active?.should == false
|
19
|
-
end
|
20
|
-
|
21
|
-
it 'new with attached callback block creates Client and activates DDEML' do
|
22
|
-
@client =
|
23
|
-
@client.id.should be_an Integer
|
24
|
-
@client.id.should_not == 0
|
25
|
-
@client.dde_active?.should == true
|
26
|
-
@client.conversation.should == nil
|
27
|
-
@client.conversation_active?.should == false
|
28
|
-
@client.service.should == nil
|
29
|
-
@client.topic.should == nil
|
30
|
-
end
|
31
|
-
|
32
|
-
describe '#start_conversation' do
|
33
|
-
|
34
|
-
context 'with inactive (uninitialized) DDE:' do
|
35
|
-
it 'fails to starts new conversation' do
|
36
|
-
lambda{@client.start_conversation('service', 'topic')}.
|
37
|
-
should raise_error /DDE is not initialized/
|
38
|
-
@client.conversation_active?.should == false
|
39
|
-
lambda{@client.start_conversation(nil, nil)}.
|
40
|
-
should raise_error /DDE is not initialized/
|
41
|
-
@client.conversation_active?.should == false
|
42
|
-
lambda{@client.start_conversation}.
|
43
|
-
should raise_error /DDE is not initialized/
|
44
|
-
@client.conversation_active?.should == false
|
45
|
-
end
|
46
|
-
end # context 'with inactive (uninitialized) DDE:'
|
47
|
-
|
48
|
-
context 'with active (initialized) DDE AND existing DDE server supporting "service" topic' do
|
49
|
-
before(:each ){start_callback_recorder}
|
50
|
-
after(:each )do
|
51
|
-
stop_callback_recorder
|
52
|
-
#p @server_calls, @client_calls # ?????????? No XTYP_DISCONNECT ? Why ?
|
53
|
-
end
|
54
|
-
|
55
|
-
it 'starts new conversation if DDE is already activated' do
|
56
|
-
res = @client.start_conversation 'service', 'topic'
|
57
|
-
res.should be_true
|
58
|
-
@client.conversation_active?.should == true
|
59
|
-
end
|
60
|
-
|
61
|
-
it 'returns self if success (allows method chain)' do
|
62
|
-
@client.start_conversation('service', 'topic').should == @client
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'sets @conversation, @service and @topic attributes' do
|
66
|
-
@client.start_conversation 'service', 'topic'
|
67
|
-
|
68
|
-
@client.conversation.should be_an Integer
|
69
|
-
@client.conversation.should_not == 0
|
70
|
-
@client.service.should be_a
|
71
|
-
@client.service.should == 'service'
|
72
|
-
@client.service.name.should == 'service'
|
73
|
-
@client.conversation.should be_an Integer
|
74
|
-
@client.conversation.should_not == 0
|
75
|
-
end
|
76
|
-
|
77
|
-
it 'initiates XTYP_CONNECT transaction to service`s callback' do
|
78
|
-
@client.start_conversation 'service', 'topic'
|
79
|
-
|
80
|
-
@server_calls.first[0].should == :XTYP_CONNECT
|
81
|
-
@server_calls.first[3].should == @client.topic
|
82
|
-
@server_calls.first[4].should == @client.service
|
83
|
-
end
|
84
|
-
|
85
|
-
it 'if server confirms connect, XTYP_CONNECT_CONFIRM transaction to service`s callback follows' do
|
86
|
-
@client.start_conversation 'service', 'topic'
|
87
|
-
|
88
|
-
# p @server_calls, @client_calls # ?????????? No XTYP_DISCONNECT ? Why ?
|
89
|
-
@server_calls[1][0].should == :XTYP_CONNECT_CONFIRM
|
90
|
-
@server_calls[1][3].should == @client.topic
|
91
|
-
@server_calls[1][4].should == @client.service
|
92
|
-
end
|
93
|
-
|
94
|
-
it 'client`s callback receives no transactions' do
|
95
|
-
@client.start_conversation 'service', 'topic'
|
96
|
-
|
97
|
-
#p @server_calls, @client.service.handle, @client.topic.handle, @client.conversation
|
98
|
-
@client_calls.should == []
|
99
|
-
end
|
100
|
-
|
101
|
-
it 'fails if another conversation is already in progress' do
|
102
|
-
@client.start_conversation 'service', 'topic'
|
103
|
-
|
104
|
-
lambda{@client.start_conversation 'service1', 'topic1'}.
|
105
|
-
should raise_error /Another conversation already established/
|
106
|
-
end
|
107
|
-
|
108
|
-
it 'fails to start conversation on unsupported service' do
|
109
|
-
lambda{@client.start_conversation('not_a_service', 'topic')}.
|
110
|
-
should raise_error /A client`s attempt to establish a conversation has failed/
|
111
|
-
@client.conversation_active?.should == false
|
112
|
-
|
113
|
-
#ensure
|
114
|
-
dde_free_string_handle(@client.id, @client.topic.handle)
|
115
|
-
dde_free_string_handle(@client.id, @client.service.handle)
|
116
|
-
end
|
117
|
-
|
118
|
-
end # context 'with active (initialized) DDE AND existing DDE server supporting "service" topic' do
|
119
|
-
end # describe '#start_conversation'
|
120
|
-
|
121
|
-
describe '#stop_conversation' do
|
122
|
-
|
123
|
-
context 'with inactive (uninitialized) DDE:' do
|
124
|
-
it 'fails to stop conversation' do
|
125
|
-
lambda{@client.stop_conversation}.
|
126
|
-
should raise_error /DDE not started/
|
127
|
-
@client.conversation_active?.should == false
|
128
|
-
end
|
129
|
-
|
130
|
-
end # context 'with inactive (uninitialized) DDE:'
|
131
|
-
|
132
|
-
context 'with active (initialized) DDE AND existing DDE server supporting "service" topic' do
|
133
|
-
before(:each ){start_callback_recorder}
|
134
|
-
after(:each ){stop_callback_recorder}
|
135
|
-
|
136
|
-
it 'fails to stop conversation' do
|
137
|
-
lambda{@client.stop_conversation}.
|
138
|
-
should raise_error /Conversation not started/
|
139
|
-
@client.conversation_active?.should == false
|
140
|
-
end
|
141
|
-
|
142
|
-
context 'conversation already started' do
|
143
|
-
before(:each){ @client.start_conversation 'service', 'topic' }
|
144
|
-
after(:each){ @client.stop_conversation if @client.conversation_active?}
|
145
|
-
|
146
|
-
it 'stops conversation' do
|
147
|
-
res = @client.stop_conversation
|
148
|
-
res.should be_true
|
149
|
-
@client.conversation_active?.should == false
|
150
|
-
end
|
151
|
-
|
152
|
-
it 'unsets @conversation, @service and @topic attributes' do
|
153
|
-
@client.stop_conversation
|
154
|
-
@client.conversation.should == nil
|
155
|
-
@client.service.should == nil
|
156
|
-
@client.topic.should == nil
|
157
|
-
end
|
158
|
-
|
159
|
-
it 'does not stop DDE' do
|
160
|
-
@client.stop_conversation
|
161
|
-
@client.dde_active?.should == true
|
162
|
-
end
|
163
|
-
|
164
|
-
it 'initiates XTYP_DISCONNECT transaction to service`s callback' do
|
165
|
-
pending
|
166
|
-
@client.stop_conversation
|
167
|
-
p @server_calls, @client_calls # ?????????? No XTYP_DISCONNECT ? Why ?
|
168
|
-
@server_calls.last[0].should == :XTYP_DISCONNECT
|
169
|
-
end
|
170
|
-
|
171
|
-
end # context 'conversation already started'
|
172
|
-
|
173
|
-
end # context 'with active (initialized) DDE AND existing DDE server supporting "service" topic'
|
174
|
-
end # describe '#stop_conversation'
|
175
|
-
|
176
|
-
describe '#send_data' do
|
177
|
-
context 'with active (initialized) DDE AND existing DDE server supporting "service" topic' do
|
178
|
-
before(:each )do
|
179
|
-
start_callback_recorder do |*args|
|
180
|
-
@server_calls << extract_values(*args)
|
181
|
-
if args[0] == XTYP_POKE
|
182
|
-
@data, @size = dde_get_data(args[5])
|
183
|
-
end
|
184
|
-
DDE_FACK
|
185
|
-
end
|
186
|
-
@client.start_conversation 'service', 'topic'
|
187
|
-
end
|
188
|
-
after(:each ){stop_callback_recorder}
|
189
|
-
|
190
|
-
it 'sends data to server' do
|
191
|
-
@client.send_data TEST_STRING, CF_TEXT, "item"
|
192
|
-
@server_calls.last[0].should == :XTYP_POKE
|
193
|
-
@data.get_bytes(0, @size).rstrip.should == TEST_STRING
|
194
|
-
end
|
195
|
-
|
196
|
-
end # context 'with active (initialized) DDE'
|
197
|
-
end # describe #send_data
|
198
|
-
|
199
|
-
end # describe DDE::Client
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/app_shared')
|
3
|
+
|
4
|
+
module DdeTest
|
5
|
+
|
6
|
+
describe Dde::Client do
|
7
|
+
before(:each){ @client = Dde::Client.new }
|
8
|
+
after(:each){ @client.stop_dde if @client.dde_active?}
|
9
|
+
|
10
|
+
it_should_behave_like "DDE App"
|
11
|
+
|
12
|
+
it 'new without parameters creates Client but does not activate DDEML' do
|
13
|
+
@client.id.should == nil
|
14
|
+
@client.conversation.should == nil
|
15
|
+
@client.service.should == nil
|
16
|
+
@client.topic.should == nil
|
17
|
+
@client.dde_active?.should == false
|
18
|
+
@client.conversation_active?.should == false
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'new with attached callback block creates Client and activates DDEML' do
|
22
|
+
@client = Dde::Client.new {|*args|}
|
23
|
+
@client.id.should be_an Integer
|
24
|
+
@client.id.should_not == 0
|
25
|
+
@client.dde_active?.should == true
|
26
|
+
@client.conversation.should == nil
|
27
|
+
@client.conversation_active?.should == false
|
28
|
+
@client.service.should == nil
|
29
|
+
@client.topic.should == nil
|
30
|
+
end
|
31
|
+
|
32
|
+
describe '#start_conversation' do
|
33
|
+
|
34
|
+
context 'with inactive (uninitialized) DDE:' do
|
35
|
+
it 'fails to starts new conversation' do
|
36
|
+
lambda{@client.start_conversation('service', 'topic')}.
|
37
|
+
should raise_error /DDE is not initialized/
|
38
|
+
@client.conversation_active?.should == false
|
39
|
+
lambda{@client.start_conversation(nil, nil)}.
|
40
|
+
should raise_error /DDE is not initialized/
|
41
|
+
@client.conversation_active?.should == false
|
42
|
+
lambda{@client.start_conversation}.
|
43
|
+
should raise_error /DDE is not initialized/
|
44
|
+
@client.conversation_active?.should == false
|
45
|
+
end
|
46
|
+
end # context 'with inactive (uninitialized) DDE:'
|
47
|
+
|
48
|
+
context 'with active (initialized) DDE AND existing DDE server supporting "service" topic' do
|
49
|
+
before(:each ){start_callback_recorder}
|
50
|
+
after(:each )do
|
51
|
+
stop_callback_recorder
|
52
|
+
#p @server_calls, @client_calls # ?????????? No XTYP_DISCONNECT ? Why ?
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'starts new conversation if DDE is already activated' do
|
56
|
+
res = @client.start_conversation 'service', 'topic'
|
57
|
+
res.should be_true
|
58
|
+
@client.conversation_active?.should == true
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'returns self if success (allows method chain)' do
|
62
|
+
@client.start_conversation('service', 'topic').should == @client
|
63
|
+
end
|
64
|
+
|
65
|
+
it 'sets @conversation, @service and @topic attributes' do
|
66
|
+
@client.start_conversation 'service', 'topic'
|
67
|
+
|
68
|
+
@client.conversation.should be_an Integer
|
69
|
+
@client.conversation.should_not == 0
|
70
|
+
@client.service.should be_a Dde::DdeString
|
71
|
+
@client.service.should == 'service'
|
72
|
+
@client.service.name.should == 'service'
|
73
|
+
@client.conversation.should be_an Integer
|
74
|
+
@client.conversation.should_not == 0
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'initiates XTYP_CONNECT transaction to service`s callback' do
|
78
|
+
@client.start_conversation 'service', 'topic'
|
79
|
+
|
80
|
+
@server_calls.first[0].should == :XTYP_CONNECT
|
81
|
+
@server_calls.first[3].should == @client.topic
|
82
|
+
@server_calls.first[4].should == @client.service
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'if server confirms connect, XTYP_CONNECT_CONFIRM transaction to service`s callback follows' do
|
86
|
+
@client.start_conversation 'service', 'topic'
|
87
|
+
|
88
|
+
# p @server_calls, @client_calls # ?????????? No XTYP_DISCONNECT ? Why ?
|
89
|
+
@server_calls[1][0].should == :XTYP_CONNECT_CONFIRM
|
90
|
+
@server_calls[1][3].should == @client.topic
|
91
|
+
@server_calls[1][4].should == @client.service
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'client`s callback receives no transactions' do
|
95
|
+
@client.start_conversation 'service', 'topic'
|
96
|
+
|
97
|
+
#p @server_calls, @client.service.handle, @client.topic.handle, @client.conversation
|
98
|
+
@client_calls.should == []
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'fails if another conversation is already in progress' do
|
102
|
+
@client.start_conversation 'service', 'topic'
|
103
|
+
|
104
|
+
lambda{@client.start_conversation 'service1', 'topic1'}.
|
105
|
+
should raise_error /Another conversation already established/
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'fails to start conversation on unsupported service' do
|
109
|
+
lambda{@client.start_conversation('not_a_service', 'topic')}.
|
110
|
+
should raise_error /A client`s attempt to establish a conversation has failed/
|
111
|
+
@client.conversation_active?.should == false
|
112
|
+
|
113
|
+
#ensure
|
114
|
+
dde_free_string_handle(@client.id, @client.topic.handle)
|
115
|
+
dde_free_string_handle(@client.id, @client.service.handle)
|
116
|
+
end
|
117
|
+
|
118
|
+
end # context 'with active (initialized) DDE AND existing DDE server supporting "service" topic' do
|
119
|
+
end # describe '#start_conversation'
|
120
|
+
|
121
|
+
describe '#stop_conversation' do
|
122
|
+
|
123
|
+
context 'with inactive (uninitialized) DDE:' do
|
124
|
+
it 'fails to stop conversation' do
|
125
|
+
lambda{@client.stop_conversation}.
|
126
|
+
should raise_error /DDE not started/
|
127
|
+
@client.conversation_active?.should == false
|
128
|
+
end
|
129
|
+
|
130
|
+
end # context 'with inactive (uninitialized) DDE:'
|
131
|
+
|
132
|
+
context 'with active (initialized) DDE AND existing DDE server supporting "service" topic' do
|
133
|
+
before(:each ){start_callback_recorder}
|
134
|
+
after(:each ){stop_callback_recorder}
|
135
|
+
|
136
|
+
it 'fails to stop conversation' do
|
137
|
+
lambda{@client.stop_conversation}.
|
138
|
+
should raise_error /Conversation not started/
|
139
|
+
@client.conversation_active?.should == false
|
140
|
+
end
|
141
|
+
|
142
|
+
context 'conversation already started' do
|
143
|
+
before(:each){ @client.start_conversation 'service', 'topic' }
|
144
|
+
after(:each){ @client.stop_conversation if @client.conversation_active?}
|
145
|
+
|
146
|
+
it 'stops conversation' do
|
147
|
+
res = @client.stop_conversation
|
148
|
+
res.should be_true
|
149
|
+
@client.conversation_active?.should == false
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'unsets @conversation, @service and @topic attributes' do
|
153
|
+
@client.stop_conversation
|
154
|
+
@client.conversation.should == nil
|
155
|
+
@client.service.should == nil
|
156
|
+
@client.topic.should == nil
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'does not stop DDE' do
|
160
|
+
@client.stop_conversation
|
161
|
+
@client.dde_active?.should == true
|
162
|
+
end
|
163
|
+
|
164
|
+
it 'initiates XTYP_DISCONNECT transaction to service`s callback' do
|
165
|
+
pending
|
166
|
+
@client.stop_conversation
|
167
|
+
p @server_calls, @client_calls # ?????????? No XTYP_DISCONNECT ? Why ?
|
168
|
+
@server_calls.last[0].should == :XTYP_DISCONNECT
|
169
|
+
end
|
170
|
+
|
171
|
+
end # context 'conversation already started'
|
172
|
+
|
173
|
+
end # context 'with active (initialized) DDE AND existing DDE server supporting "service" topic'
|
174
|
+
end # describe '#stop_conversation'
|
175
|
+
|
176
|
+
describe '#send_data' do
|
177
|
+
context 'with active (initialized) DDE AND existing DDE server supporting "service" topic' do
|
178
|
+
before(:each )do
|
179
|
+
start_callback_recorder do |*args|
|
180
|
+
@server_calls << extract_values(*args)
|
181
|
+
if args[0] == XTYP_POKE
|
182
|
+
@data, @size = dde_get_data(args[5])
|
183
|
+
end
|
184
|
+
DDE_FACK
|
185
|
+
end
|
186
|
+
@client.start_conversation 'service', 'topic'
|
187
|
+
end
|
188
|
+
after(:each ){stop_callback_recorder}
|
189
|
+
|
190
|
+
it 'sends data to server' do
|
191
|
+
@client.send_data TEST_STRING, CF_TEXT, "item"
|
192
|
+
@server_calls.last[0].should == :XTYP_POKE
|
193
|
+
@data.get_bytes(0, @size).rstrip.should == TEST_STRING
|
194
|
+
end
|
195
|
+
|
196
|
+
end # context 'with active (initialized) DDE'
|
197
|
+
end # describe #send_data
|
198
|
+
|
199
|
+
end # describe DDE::Client
|
200
200
|
end
|
data/spec/dde/dde_string_spec.rb
CHANGED
@@ -1,40 +1,40 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
-
|
3
|
-
module
|
4
|
-
describe
|
5
|
-
before(:each ){ @app =
|
6
|
-
|
7
|
-
context ' with valid instance id of active DDE application' do
|
8
|
-
it 'can be created from normal string' do
|
9
|
-
dde_string =
|
10
|
-
dde_string == "My_String"
|
11
|
-
dde_string.handle.should be_an Integer
|
12
|
-
dde_string.handle.should_not == 0
|
13
|
-
end
|
14
|
-
|
15
|
-
it 'can be created from valid DDE string handle' do
|
16
|
-
string_handle = dde_create_string_handle(@app.id, 'My String')
|
17
|
-
dde_string =
|
18
|
-
dde_string == "My_String"
|
19
|
-
dde_string.handle.should be_an Integer
|
20
|
-
dde_string.handle.should_not == 0
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
context ' without instance id of active DDE application' do
|
25
|
-
it 'cannot be created from String' do
|
26
|
-
lambda{
|
27
|
-
lambda{
|
28
|
-
lambda{
|
29
|
-
end
|
30
|
-
|
31
|
-
it 'cannot be created from valid string handle' do
|
32
|
-
string_handle = dde_create_string_handle(@app.id, 'My String')
|
33
|
-
lambda{
|
34
|
-
lambda{
|
35
|
-
lambda{
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
|
+
|
3
|
+
module DdeTest
|
4
|
+
describe Dde::DdeString do
|
5
|
+
before(:each ){ @app = Dde::App.new {|*args|}}
|
6
|
+
|
7
|
+
context ' with valid instance id of active DDE application' do
|
8
|
+
it 'can be created from normal string' do
|
9
|
+
dde_string = Dde::DdeString.new(@app.id, "My_String")
|
10
|
+
dde_string == "My_String"
|
11
|
+
dde_string.handle.should be_an Integer
|
12
|
+
dde_string.handle.should_not == 0
|
13
|
+
end
|
14
|
+
|
15
|
+
it 'can be created from valid DDE string handle' do
|
16
|
+
string_handle = dde_create_string_handle(@app.id, 'My String')
|
17
|
+
dde_string = Dde::DdeString.new(@app.id, string_handle)
|
18
|
+
dde_string == "My_String"
|
19
|
+
dde_string.handle.should be_an Integer
|
20
|
+
dde_string.handle.should_not == 0
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context ' without instance id of active DDE application' do
|
25
|
+
it 'cannot be created from String' do
|
26
|
+
lambda{Dde::DdeString.new(nil, "My_String")}.should raise_error Dde::Errors::StringError
|
27
|
+
lambda{Dde::DdeString.new(12345, "My_String")}.should raise_error Dde::Errors::StringError
|
28
|
+
lambda{Dde::DdeString.new(0, "My_String")}.should raise_error Dde::Errors::StringError
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'cannot be created from valid string handle' do
|
32
|
+
string_handle = dde_create_string_handle(@app.id, 'My String')
|
33
|
+
lambda{Dde::DdeString.new(nil, string_handle)}.should raise_error Dde::Errors::StringError
|
34
|
+
lambda{Dde::DdeString.new(12345, string_handle)}.should raise_error Dde::Errors::StringError
|
35
|
+
lambda{Dde::DdeString.new(0, string_handle)}.should raise_error Dde::Errors::StringError
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
40
|
end
|