repla 0.4.0 → 0.5.0
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/lib/repla/dependencies/lib/controller.rb +22 -24
- data/lib/repla/dependencies/lib/model.rb +11 -8
- data/lib/repla/dependencies/lib/tester.rb +15 -15
- data/lib/repla/dependencies/lib/view.rb +19 -14
- data/lib/repla/dependencies.rb +25 -24
- data/lib/repla/lib/constants.rb +4 -4
- data/lib/repla/lib/controller.rb +1 -0
- data/lib/repla/lib/escape.rb +70 -0
- data/lib/repla/lib/module.rb +42 -59
- data/lib/repla/lib/view/javascript.rb +12 -31
- data/lib/repla/lib/view.rb +6 -7
- data/lib/repla/lib/window.rb +16 -12
- data/lib/repla/logger/test/lib/test_setup.rb +3 -2
- data/lib/repla/logger/test/lib/test_view_helper.rb +18 -19
- data/lib/repla/logger/test/tc_logger.rb +56 -56
- data/lib/repla/logger.rb +24 -23
- data/lib/repla/repl/lib/input_controller.rb +12 -13
- data/lib/repla/repl/lib/output_controller.rb +13 -14
- data/lib/repla/repl/lib/view.rb +23 -19
- data/lib/repla/repl.rb +37 -36
- data/lib/repla/resources/js/bullets/test/run_tests.rb +1 -1
- data/lib/repla/test/bundles/HelloWorld.wcplugin/Contents/Resources/hello_world.rb +1 -1
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/controller.rb +16 -12
- data/lib/repla/test/bundles/Print.wcplugin/Contents/Resources/lib/view.rb +15 -9
- data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Resources/constants.rb +1 -1
- data/lib/repla/test/bundles/TestEnvironment.wcplugin/Contents/Resources/test_environment.rb +12 -17
- data/lib/repla/test/bundles/TestLog.wcplugin/Contents/Resources/test_log.rb +5 -5
- data/lib/repla/test/lib/helper.rb +5 -25
- data/lib/repla/test.rb +2 -2
- data/lib/repla.rb +1 -0
- metadata +2 -1
@@ -1,35 +1,30 @@
|
|
1
1
|
#!/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'test/unit'
|
4
4
|
|
5
5
|
require_relative '../../../../../../lib/repla'
|
6
|
-
require_relative
|
7
|
-
|
8
|
-
class ::String
|
9
|
-
def is_integer?
|
10
|
-
self.to_i.to_s == self
|
11
|
-
end
|
12
|
-
end
|
6
|
+
require_relative 'constants'
|
7
|
+
require_relative '../../../../../lib/escape'
|
13
8
|
|
9
|
+
# Test environment
|
14
10
|
class TestEnviroment < Test::Unit::TestCase
|
15
|
-
|
11
|
+
using Escape
|
16
12
|
def test_plugin_name_key
|
17
|
-
assert(ENV.
|
13
|
+
assert(ENV.key?(Repla::PLUGIN_NAME_KEY))
|
18
14
|
plugin_name = ENV[Repla::PLUGIN_NAME_KEY]
|
19
|
-
assert_equal(plugin_name, TEST_PLUGIN_NAME
|
15
|
+
assert_equal(plugin_name, TEST_PLUGIN_NAME)
|
20
16
|
end
|
21
17
|
|
22
18
|
def test_split_id_key
|
23
|
-
assert(ENV.
|
19
|
+
assert(ENV.key?(Repla::SPLIT_ID_KEY))
|
24
20
|
window_id = ENV[Repla::SPLIT_ID_KEY]
|
25
|
-
assert(!window_id.
|
21
|
+
assert(!window_id.integer?)
|
26
22
|
end
|
27
23
|
|
28
24
|
def test_window_id_key
|
29
|
-
assert(ENV.
|
25
|
+
assert(ENV.key?(Repla::WINDOW_ID_KEY))
|
30
26
|
window_id = ENV[Repla::WINDOW_ID_KEY]
|
31
|
-
assert(window_id.
|
32
|
-
assert(window_id.to_i > 0
|
27
|
+
assert(window_id.integer?)
|
28
|
+
assert(window_id.to_i > 0)
|
33
29
|
end
|
34
|
-
|
35
30
|
end
|
@@ -4,10 +4,10 @@ require_relative '../../../../../../lib/repla'
|
|
4
4
|
require_relative '../../../../../../lib/repla/logger'
|
5
5
|
|
6
6
|
logger = Repla::Logger.new
|
7
|
-
logger.info(
|
8
|
-
puts
|
9
|
-
STDERR.puts
|
7
|
+
logger.info('Testing log message')
|
8
|
+
puts 'Testing print to standard input'
|
9
|
+
STDERR.puts 'Testing print to standard error'
|
10
10
|
window = Repla::Window.new
|
11
|
-
window.do_javascript(
|
12
|
-
logger.error(
|
11
|
+
window.do_javascript('document.body.innerHTML = "test";')
|
12
|
+
logger.error('Testing log error')
|
13
13
|
logger.show
|
@@ -1,8 +1,12 @@
|
|
1
1
|
require 'Shellwords'
|
2
|
+
require_relative '../../lib/escape'
|
2
3
|
|
3
4
|
module Repla
|
4
5
|
module Test
|
6
|
+
# Test helper
|
5
7
|
module Helper
|
8
|
+
using Escape
|
9
|
+
|
6
10
|
APPLESCRIPT_DIRECTORY = File.join(File.dirname(__FILE__), '..',
|
7
11
|
'applescript')
|
8
12
|
|
@@ -41,7 +45,7 @@ module Repla
|
|
41
45
|
|
42
46
|
ISRUNNINGAPPLESCRIPT_FILE = File.join(APPLESCRIPT_DIRECTORY,
|
43
47
|
'is_running.applescript')
|
44
|
-
def
|
48
|
+
def app_running?
|
45
49
|
result = run_applescript(ISRUNNINGAPPLESCRIPT_FILE)
|
46
50
|
result == 'true'
|
47
51
|
end
|
@@ -92,30 +96,6 @@ module Repla
|
|
92
96
|
|
93
97
|
result
|
94
98
|
end
|
95
|
-
|
96
|
-
class ::String
|
97
|
-
def float?
|
98
|
-
!!Float(self)
|
99
|
-
rescue StandardError
|
100
|
-
false
|
101
|
-
end
|
102
|
-
|
103
|
-
def integer?
|
104
|
-
to_i.to_s == self
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
class ::Float
|
109
|
-
def javascript_argument
|
110
|
-
to_s
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
class ::Integer
|
115
|
-
def javascript_argument
|
116
|
-
to_s
|
117
|
-
end
|
118
|
-
end
|
119
99
|
end
|
120
100
|
end
|
121
101
|
end
|
data/lib/repla/test.rb
CHANGED
@@ -27,8 +27,8 @@ module Repla
|
|
27
27
|
TEST_HTML_DIRECTORY = File.join(TEST_DIRECTORY, 'html')
|
28
28
|
INDEX_HTML_FILE = File.join(TEST_HTML_DIRECTORY, 'index.html')
|
29
29
|
INDEXJQUERY_HTML_FILE = File.join(TEST_HTML_DIRECTORY, 'indexjquery.html')
|
30
|
-
INDEX_HTML_TITLE = 'Index'
|
31
|
-
INDEXJQUERY_HTML_TITLE = 'Index JQuery'
|
30
|
+
INDEX_HTML_TITLE = 'Index'.freeze
|
31
|
+
INDEXJQUERY_HTML_TITLE = 'Index JQuery'.freeze
|
32
32
|
|
33
33
|
# JavaScript
|
34
34
|
TEST_ASSETS_JAVASCRIPT_DIRECTORY = File.join(TEST_DIRECTORY, 'js')
|
data/lib/repla.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: repla
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roben Kleene
|
@@ -45,6 +45,7 @@ files:
|
|
45
45
|
- lib/repla/dependencies/lib/view.rb
|
46
46
|
- lib/repla/lib/constants.rb
|
47
47
|
- lib/repla/lib/controller.rb
|
48
|
+
- lib/repla/lib/escape.rb
|
48
49
|
- lib/repla/lib/module.rb
|
49
50
|
- lib/repla/lib/view.rb
|
50
51
|
- lib/repla/lib/view/javascript.rb
|