tui-td 0.2.0 → 0.2.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8ebaa8989019a8cd573f682a538ca76a21a17daee810f29a1f178f8f35f0008
4
- data.tar.gz: 52fecfc7d59143648f450e71612ac7b7b6839e1b697d03056cb80e0a0dd067ac
3
+ metadata.gz: b74325984554c843a191d5affcf77472229000da6f14551c26ca2e6f1b0425cd
4
+ data.tar.gz: 2ddeb1aaedfc23ca62e3e791bb254950ef4432a32f0031e0a144f7567e2a3785
5
5
  SHA512:
6
- metadata.gz: 9563af163f07bbaae4ea0427120785cc814c444289f7a6bc75b527d9a2e2a5a29785b99f40fa7c31c807c10708693f7f1a5cb5d9c39fea40b82a31e8d8c56964
7
- data.tar.gz: 6912a0399394405e8678e33b13b1c95a7575ce5ef7f7731c23a514d2f55c720724c1f4d17bcb73be654a58461bade34d03adfcfd7e615509d1244c53ac8a8673
6
+ metadata.gz: b02944c10ed90a607ccfadd80fe80237a1bd5d50bba8e92320875c3cc71181f04057d2cad78648f5ddefee7a149b179c215c12b0ed61a19af7363b658090e36a
7
+ data.tar.gz: fe0f2b747cc15fe39da0195c83371ef44c457194f1648aa5e4e03f525ac856a60f3561a482012009054158350d354ea7cf28a04ab75eb9d660c1712203364373
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # CHANGELOG
2
2
 
3
+ ## 0.2.2
4
+
5
+ - `wait_for_exit` and `assert_exit` test steps — test process exit codes
6
+
7
+ ## 0.2.1
8
+
9
+ - `Driver#refresh` — explicit state re-parse for MCP server clients
10
+
3
11
  ## 0.2.0
4
12
 
5
13
  - Live debug modes for `tui-td test`: `-v` (verbose), `-l` (live screen-refresh), `-s` (step-by-step pause)
data/README.md CHANGED
@@ -142,6 +142,16 @@ Global options:
142
142
  `tui-td --help` serves as the full CLI reference. `tui-td help test` shows all JSON test
143
143
  step types and `tui-td help rspec` shows all RSpec matchers — no need to consult the docs.
144
144
 
145
+ ## Demo
146
+
147
+ Step-by-step live view of a vim test — type "Hello World", copy the line, replace "World" with "Sun":
148
+
149
+ ![vim test demo](examples/vim_demo.gif)
150
+
151
+ ```bash
152
+ tui-td -vls test examples/vim_hello_world.json
153
+ ```
154
+
145
155
  ## Ruby API
146
156
 
147
157
  ### Driver — Start, send, capture
data/lib/tui_td/cli.rb CHANGED
@@ -367,8 +367,14 @@ module TUITD
367
367
  {"html": "<path>"}
368
368
  Save an HTML render. Path defaults to /tmp/tui_td_<ts>.html.
369
369
 
370
+ {"wait_for_exit": true}
371
+ Wait until the process exits naturally.
372
+
373
+ {"assert_exit": <N>}
374
+ Assert the process exit status equals N.
375
+
370
376
  {"close": true}
371
- Close the driver session.
377
+ Close the driver session (force-kill if needed).
372
378
 
373
379
  Example test file: examples/echo_test.json
374
380
  HELP
data/lib/tui_td/driver.rb CHANGED
@@ -117,12 +117,28 @@ module TUITD
117
117
  @wait_thr&.value
118
118
  end
119
119
 
120
+ # Get the process exit status (nil if still running)
121
+ def exitstatus
122
+ return nil unless @wait_thr
123
+ status = @wait_thr.value
124
+ status&.exitstatus
125
+ rescue NoMethodError
126
+ nil
127
+ end
128
+
120
129
  # Get the terminal output (raw ANSI + text)
121
130
  def raw_output
122
131
  read_available!
123
132
  @output_mutex.synchronize { @output_buffer.dup }
124
133
  end
125
134
 
135
+ # Refresh the terminal state by re-parsing the output buffer.
136
+ # Call this if the terminal content has changed and you need an up-to-date state.
137
+ def refresh
138
+ refresh_state!
139
+ @state
140
+ end
141
+
126
142
  # Get structured terminal state as a Hash
127
143
  def state_data
128
144
  refresh_state! if @state.nil?
@@ -136,6 +136,22 @@ module TUITD
136
136
  HtmlRenderer.new(driver.state_data).render(path)
137
137
  Result.new(step: action, passed: true, message: "Saved: #{path}")
138
138
 
139
+ when "wait_for_exit"
140
+ ensure_driver!(driver)
141
+ driver.wait_for_exit
142
+ status = driver.exitstatus
143
+ Result.new(step: action, passed: true, message: "Exited with status #{status}")
144
+
145
+ when "assert_exit"
146
+ ensure_driver!(driver)
147
+ expected = value.to_s.to_i
148
+ actual = driver.exitstatus
149
+ if actual == expected
150
+ Result.new(step: action, passed: true, message: "Exit status #{expected} matches")
151
+ else
152
+ Result.new(step: action, passed: false, message: "Exit status #{actual}, expected #{expected}")
153
+ end
154
+
139
155
  when "close"
140
156
  driver&.close
141
157
  driver = nil
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module TUITD
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tui-td
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Haluk Durmus