yamatanooroti 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c50ad7cbec4e89075f4acc1c3060abdc3451177a5087460a4e5120db8cbe62ba
4
- data.tar.gz: 2e0b61f737a29e7eb949f6594bb1718dbb761555a22cd05a686fafddd931f228
3
+ metadata.gz: c009e6dc5f113b62e9e62a6c1ce27130b2f2100f9ab0aa2a959afb893eace993
4
+ data.tar.gz: dd24b52416f695388dda859d1f538662d15bead1e16b6b0b5702baf40702a54e
5
5
  SHA512:
6
- metadata.gz: 2a9a3071d7eac0a2036fe3671b21a98fb84469ccb89a472380163f6d4ea98043925cff1a9548244d23d2aa44bac2cb062da6cdc0655b8c73fb54ec2136da5214
7
- data.tar.gz: 6aabb244234bdd034fc0a870726b8d5ecf88e526c2a4483916c9a1caec51901d5408435b20a50053b25e019ad152e90a9935853e4c6c9db290dc0e383f1321ce
6
+ metadata.gz: 5a412b98347bd3e0b251905fa8f2de3dd54763899dcd80f50635d5d13f9166a2d0dbe80daa06faabd03a5ef000862db7d42951b935c15ecb75fd278b7e79c834
7
+ data.tar.gz: 137f7d47e13c565daf6ffaf3cf56b47f00937ac6c61255bab821013fc408e14318b5b9110edf80e3c8796d7866e498665a190ff444fc28bea3704f9efb67afe6
@@ -78,9 +78,8 @@ class Yamatanooroti::TestCase < Test::Unit::TestCase
78
78
  def klass.method_added(name)
79
79
  super
80
80
  if ancestors[1] == Yamatanooroti::TestCase
81
- @@runners.each do |test_klass|
82
- test_klass.define_method(name, instance_method(name))
83
- end
81
+ test_klass = @@runners.find { |test_klass| test_klass.ancestors.include?(self) }
82
+ test_klass.define_method(name, instance_method(name))
84
83
  remove_method name
85
84
  end
86
85
  end
@@ -1,3 +1,3 @@
1
1
  class Yamatanooroti
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -1,13 +1,14 @@
1
1
  require 'test-unit'
2
2
  require 'vterm'
3
3
  require 'pty'
4
+ require 'io/console'
4
5
 
5
6
  module Yamatanooroti::VTermTestCaseModule
6
7
  def start_terminal(height, width, command, wait: 0.1)
7
8
  @wait = wait
8
9
  @result = nil
9
10
 
10
- @pty_output, @pty_input, @pid = PTY.spawn(*command)
11
+ @pty_output, @pty_input, @pid = PTY.spawn('bash', '-c', %[stty rows #{height.to_s} cols #{width.to_s}; "$@"], '--', *command)
11
12
 
12
13
  @vterm = VTerm.new(height, width)
13
14
  @vterm.set_utf8(true)
@@ -11,7 +11,7 @@ module Yamatanooroti::WindowsDefinition
11
11
 
12
12
  typealias 'SHORT', 'short'
13
13
  typealias 'HPCON', 'HANDLE'
14
- typealias 'HPCON', 'HANDLE'
14
+ typealias 'HWND', 'HANDLE'
15
15
  typealias 'HRESULT', 'HANDLE'
16
16
  typealias 'LPVOID', 'void*'
17
17
  typealias 'SIZE_T', 'size_t'
@@ -146,6 +146,7 @@ module Yamatanooroti::WindowsDefinition
146
146
  C3_IDEOGRAPH = 0x0100
147
147
  TH32CS_SNAPPROCESS = 0x00000002
148
148
  PROCESS_ALL_ACCESS = 0x001FFFFF
149
+ SW_HIDE = 0
149
150
 
150
151
  # HANDLE GetStdHandle(DWORD nStdHandle);
151
152
  extern 'HANDLE GetStdHandle(DWORD);', :stdcall
@@ -158,6 +159,10 @@ module Yamatanooroti::WindowsDefinition
158
159
  extern 'BOOL AllocConsole(void);', :stdcall
159
160
  # BOOL AttachConsole(DWORD dwProcessId);
160
161
  extern 'BOOL AttachConsole(DWORD);', :stdcall
162
+ # BOOL ShowWindow(HWND hWnd, int nCmdShow);
163
+ extern 'BOOL ShowWindow(HWND hWnd,int nCmdShow);', :stdcall
164
+ # HWND WINAPI GetConsoleWindow(void);
165
+ extern 'HWND GetConsoleWindow(void);', :stdcall
161
166
  # BOOL WINAPI SetConsoleScreenBufferSize(HANDLE hConsoleOutput, COORD dwSize);
162
167
  extern 'BOOL SetConsoleScreenBufferSize(HANDLE, COORD);', :stdcall
163
168
  # BOOL WINAPI SetConsoleWindowInfo(HANDLE hConsoleOutput, BOOL bAbsolute, const SMALL_RECT *lpConsoleWindow);
@@ -247,6 +252,8 @@ module Yamatanooroti::WindowsTestCaseModule
247
252
  size = height * 65536 + width
248
253
  r = DL.SetConsoleScreenBufferSize(@output_handle, size)
249
254
  error_message(r, 'SetConsoleScreenBufferSize')
255
+ r = DL.ShowWindow(DL.GetConsoleWindow(), DL::SW_HIDE)
256
+ error_message(r, 'ShowWindow')
250
257
  end
251
258
 
252
259
  private def mb2wc(str)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yamatanooroti
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - aycabta
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-10 00:00:00.000000000 Z
11
+ date: 2020-09-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit