File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : sig
2+
3+ on : [push, pull_request]
4+
5+ jobs :
6+ sig :
7+ runs-on : ubuntu-latest
8+ env :
9+ BUNDLE_WITH : sig
10+ steps :
11+ - uses : actions/checkout@v6
12+ - name : Set up Ruby
13+ uses : ruby/setup-ruby@v1
14+ with :
15+ ruby-version : ruby
16+ bundler-cache : true
17+ - name : Run RBS test
18+ run : bundle exec rake rbs:test
Original file line number Diff line number Diff line change 55gem "rake"
66gem "test-unit"
77gem "test-unit-ruby-core"
8+
9+ group :sig do
10+ gem "rbs"
11+ gem "rdoc"
12+ end
Original file line number Diff line number Diff line change @@ -7,4 +7,12 @@ Rake::TestTask.new(:test) do |t|
77 t . test_files = FileList [ "test/**/test_*.rb" ]
88end
99
10+ namespace :rbs do
11+ Rake ::TestTask . new ( :test ) do |t |
12+ t . libs << "test_sig"
13+ t . ruby_opts << "-rtest_helper"
14+ t . test_files = FileList [ "test_sig/test_*.rb" ]
15+ end
16+ end
17+
1018task :default => :test
Original file line number Diff line number Diff line change 1+ require "pathname"
2+ require "test/unit"
3+ require "rbs"
4+ require "rbs/test"
5+ require "rbs/unit_test"
6+
7+ module NetHTTPTestSigHelper
8+ extend self
9+
10+ LOCAL_SIG_DIR = Pathname ( __dir__ ) . join ( ".." , "sig" ) . expand_path
11+ SUPPORT_LIBRARIES = %w[
12+ cgi
13+ net-protocol
14+ open-uri
15+ openssl
16+ resolv
17+ securerandom
18+ socket
19+ strscan
20+ tempfile
21+ timeout
22+ uri
23+ zlib
24+ ] . freeze
25+
26+ def env
27+ @env ||= begin
28+ loader = RBS ::EnvironmentLoader . new
29+ loader . add ( path : LOCAL_SIG_DIR )
30+ SUPPORT_LIBRARIES . each do |library |
31+ loader . add ( library : library , version : nil )
32+ end
33+ RBS ::Environment . from_loader ( loader ) . resolve_type_names
34+ end
35+ end
36+ end
37+
38+ class NetHTTPRBSTestCase < Test ::Unit ::TestCase
39+ include RBS ::UnitTest ::TypeAssertions
40+
41+ def self . env
42+ NetHTTPTestSigHelper . env
43+ end
44+
45+ def self . builder
46+ @builder ||= RBS ::DefinitionBuilder . new ( env : env )
47+ end
48+ end
You can’t perform that action at this time.
0 commit comments