notepadqq_api 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/test/test_message_interpreter.rb +51 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f52c91e83b7359a8c37b067f2862e161b0ce5ad2
|
4
|
+
data.tar.gz: 0cc88eecc6f04dcf76ad5b81f6598c32638f0231
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cefc711dcd60dd87108be54cc633f6c4b0b05eae2db24632bcbc9415b8f6b057cdee90d3e335ee68e452d77522e8d60c5190c47cf6a3601f509c195f20ec14c9
|
7
|
+
data.tar.gz: ff1739bb8a424a39a2db387fa510f63a5f3c2ade62e39c3b33fbc5a0750044b6c71b3d4610d48db7acd5cc7461be50d0fd7bb8b51470e38d27a602a65d2b3588
|
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'test/unit'
|
2
|
+
require 'notepadqq_api/message_channel'
|
3
|
+
require 'notepadqq_api/message_interpreter'
|
4
|
+
require 'notepadqq_api/stubs'
|
5
|
+
|
6
|
+
class ChannelStub
|
7
|
+
def initialize(socketPath) end
|
8
|
+
def sendMessage(msg) end
|
9
|
+
def getMessages(block=true) end
|
10
|
+
def getNextResultMessage() end
|
11
|
+
end
|
12
|
+
|
13
|
+
class MessageInterpreterTest < Test::Unit::TestCase
|
14
|
+
|
15
|
+
def test_invokeApi_simple_return
|
16
|
+
channel = ChannelStub.new nil
|
17
|
+
def channel.getNextResultMessage
|
18
|
+
{
|
19
|
+
'err' => 0,
|
20
|
+
'result' => {"$__nqq__stub_type" => 'Notepadqq', "id" => 7}
|
21
|
+
}
|
22
|
+
end
|
23
|
+
|
24
|
+
interpreter = NotepadqqApi::MessageInterpreter.new channel
|
25
|
+
|
26
|
+
retval = interpreter.invokeApi(1, 'example', [])
|
27
|
+
assert_equal NotepadqqApi::Stubs::Notepadqq.new(interpreter, 7), retval
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_invokeApi_array_return
|
31
|
+
channel = ChannelStub.new nil
|
32
|
+
def channel.getNextResultMessage
|
33
|
+
{
|
34
|
+
'err' => 0,
|
35
|
+
'result' => [{"$__nqq__stub_type" => 'Notepadqq', "id" => 7},
|
36
|
+
42,
|
37
|
+
{"$__nqq__stub_type" => 'Editor', "id" => 10}
|
38
|
+
]
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
interpreter = NotepadqqApi::MessageInterpreter.new channel
|
43
|
+
|
44
|
+
retval = interpreter.invokeApi(1, 'example', [])
|
45
|
+
assert_equal [NotepadqqApi::Stubs::Notepadqq.new(interpreter, 7),
|
46
|
+
42,
|
47
|
+
NotepadqqApi::Stubs::Editor.new(interpreter, 10)
|
48
|
+
], retval
|
49
|
+
end
|
50
|
+
|
51
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notepadqq_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniele Di Sarli
|
@@ -48,6 +48,7 @@ files:
|
|
48
48
|
- lib/notepadqq_api/message_channel.rb
|
49
49
|
- lib/notepadqq_api/message_interpreter.rb
|
50
50
|
- lib/notepadqq_api/stubs.rb
|
51
|
+
- test/test_message_interpreter.rb
|
51
52
|
homepage: http://rubygems.org/gems/hola
|
52
53
|
licenses:
|
53
54
|
- MIT
|