Skip to content

Commit

Permalink
Add spec for Clipboard::Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
janlelis committed Apr 6, 2024
1 parent 25357ba commit 43c4a57
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
* All implementations are now based on `Clipboard::Implementation`
* Move implementation detection to `utils.rb`

### Other
* Add more specs and run them on GitHub Actions CI

## 1.4.1
* Always use plaintext mimetype for wl-clipboard
* Do not include newline when pasting from wl-clipboard
Expand Down
27 changes: 27 additions & 0 deletions spec/clipboard_windows_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require_relative "spec_helper"

require "rbconfig"

if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
require 'clipboard/windows'

describe "Clipboard::Windows" do
before :all do
Clipboard.implementation = Clipboard::Windows
end

it "can copy & paste" do
expect( Clipboard.copy('example') ).to eq true
expect( Clipboard.paste ).to eq 'example'.encode("UTF16-LE")
end

it "can clear" do
expect( Clipboard.copy('example') ).to eq true
expect( Clipboard.paste ).to eq 'example'.encode("UTF16-LE")
Clipboard.clear
expect( Clipboard.paste ).to eq ''
end
end
end

0 comments on commit 43c4a57

Please sign in to comment.