-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1339 from soutaro/test-typecheck
Set up type checking tests
- Loading branch information
Showing
81 changed files
with
3,615 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,51 @@ | ||
D = Steep::Diagnostic | ||
|
||
FileUtils.mkpath("tmp") | ||
tmp_rbs_dir = Pathname("tmp/rbs-sig") | ||
|
||
definition = Bundler::Definition.build(Pathname("Gemfile"), Pathname("Gemfile.lock"), nil) | ||
rbs_dep = definition.dependencies.find {|dep| dep.name == "rbs" } | ||
if (source = rbs_dep&.source).is_a?(Bundler::Source::Path) | ||
unless tmp_rbs_dir.directory? | ||
FileUtils.ln_s(Pathname.pwd + source.path + "sig", tmp_rbs_dir.to_s, force: true) | ||
end | ||
else | ||
FileUtils.rm_f(tmp_rbs_dir) | ||
library "rbs" | ||
end | ||
|
||
target :app do | ||
collection_config "rbs_collection.steep.yaml" | ||
|
||
check "lib" | ||
ignore "lib/steep/shims" | ||
|
||
signature "sig" | ||
|
||
collection_config "rbs_collection.steep.yaml" | ||
ignore_signature "sig/test" | ||
|
||
configure_code_diagnostics(D::Ruby.strict) do |hash| | ||
end | ||
|
||
FileUtils.mkpath("tmp") | ||
tmp_rbs_dir = File.join("tmp", "rbs-sig") | ||
if tmp_rbs_dir.directory? | ||
signature tmp_rbs_dir.to_s | ||
else | ||
library "rbs" | ||
end | ||
end | ||
|
||
target :test do | ||
collection_config "rbs_collection.steep.yaml" | ||
|
||
unreferenced! | ||
|
||
check "test" | ||
signature "sig/test" | ||
|
||
configure_code_diagnostics(D::Ruby.lenient) | ||
|
||
definition = Bundler::Definition.build(Pathname("Gemfile"), Pathname("Gemfile.lock"), nil) | ||
rbs_dep = definition.dependencies.find {|dep| dep.name == "rbs" } | ||
if (source = rbs_dep&.source).is_a?(Bundler::Source::Path) | ||
unless Pathname(tmp_rbs_dir).exist? | ||
FileUtils.ln_s(Pathname.pwd + source.path + "sig", tmp_rbs_dir, force: true) | ||
end | ||
signature tmp_rbs_dir | ||
if tmp_rbs_dir.directory? | ||
signature tmp_rbs_dir.to_s | ||
else | ||
FileUtils.rm_f(tmp_rbs_dir) | ||
library "rbs" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/env bash | ||
|
||
BINSTUB_DIR=$(cd $(dirname $0); pwd) | ||
GEMFILE=$(readlink -f ${BINSTUB_DIR}/../gemfile_steep/Gemfile) | ||
ROOT_DIR=$(readlink -f ${BINSTUB_DIR}/..) | ||
|
||
RBSINLINE="bundle exec --gemfile=${GEMFILE} rbs-inline" | ||
|
||
if type "rbenv" > /dev/null 2>&1; then | ||
RBSINLINE="rbenv exec ${RBSINLINE}" | ||
else | ||
if type "rvm" > /dev/null 2>&1; then | ||
if [ -e ${ROOT_DIR}/.ruby-version ]; then | ||
RBS="rvm ${ROOT_DIR} do ${RBSINLINE}" | ||
fi | ||
fi | ||
fi | ||
|
||
exec $RBSINLINE $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
source "https://rubygems.org" | ||
|
||
gem 'steep', "~> 1.9.0.dev", require: false | ||
gem "rbs-inline", require: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Generated from test/annotation_collection_test.rb with RBS::Inline | ||
|
||
class AnnotationCollectionTest < Minitest::Test | ||
include TestHelper | ||
|
||
include FactoryHelper | ||
|
||
Annotation: untyped | ||
|
||
Types: untyped | ||
|
||
AST: untyped | ||
|
||
def new_collection: (current_module: untyped, factory: untyped) -> untyped | ||
|
||
RBIS: ::Hash[untyped, untyped] | ||
|
||
def test_types: () -> untyped | ||
|
||
def test_dynamics: () -> untyped | ||
|
||
def test_merge_block_annotations: () -> untyped | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Generated from test/annotation_parsing_test.rb with RBS::Inline | ||
|
||
class AnnotationParsingTest < Minitest::Test | ||
include TestHelper | ||
|
||
include ASTAssertion | ||
|
||
include FactoryHelper | ||
|
||
AnnotationParser: untyped | ||
|
||
Annotation: untyped | ||
|
||
Types: untyped | ||
|
||
def parse_type: (untyped src, factory: untyped) -> untyped | ||
|
||
def parse_annotation: (untyped source, factory: untyped) -> untyped | ||
|
||
def test_skip_annotation: () -> untyped | ||
|
||
def test_var_type_annotation: () -> untyped | ||
|
||
def test_method_annotation: () -> untyped | ||
|
||
def test_return_type_annotation: () -> untyped | ||
|
||
def test_block_type_annotation: () -> untyped | ||
|
||
def test_self_type: () -> untyped | ||
|
||
def test_const_type: () -> untyped | ||
|
||
def test_const_type2: () -> untyped | ||
|
||
def test_const_type3: () -> untyped | ||
|
||
def test_instance_type: () -> untyped | ||
|
||
def test_module_type: () -> untyped | ||
|
||
def test_implements: () -> untyped | ||
|
||
def test_implement2: () -> untyped | ||
|
||
def test_ivar_type: () -> untyped | ||
|
||
def test_dynamic: () -> untyped | ||
|
||
def test_break: () -> untyped | ||
|
||
def test_annotation_syntax_error: () -> untyped | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Generated from test/args_test.rb with RBS::Inline | ||
|
||
class ArgsTest < Minitest::Test | ||
include TestHelper | ||
|
||
include FactoryHelper | ||
|
||
SendArgs: untyped | ||
|
||
Params: untyped | ||
|
||
Types: untyped | ||
|
||
AST: untyped | ||
|
||
def around: () -> untyped | ||
|
||
def method_name: () -> untyped | ||
|
||
def parse_args: (untyped source) -> untyped | ||
|
||
def test_positional_single_arg: () -> untyped | ||
|
||
def test_positional_no_arg: () -> untyped | ||
|
||
def test_positional_consume: () -> untyped | ||
|
||
def test_positional_rest_arg: () -> untyped | ||
|
||
def test_keyword_single_keyword_arg: () -> untyped | ||
|
||
def test_keyword_single_keyword_no_arg: () -> untyped | ||
|
||
def test_keyword_single_rocket_arg: () -> untyped | ||
|
||
def test_keyword_splat_arg: () -> untyped | ||
|
||
def test_keyword_consume_keys: () -> untyped | ||
|
||
def test_compat_keyword_positional_arg: () -> untyped | ||
|
||
def test_block_pass_arg: () -> untyped | ||
|
||
def test_each_single_args: () -> untyped | ||
|
||
def test_each_missing_arg: () -> untyped | ||
|
||
def test_each_splat_tuple: () -> untyped | ||
|
||
def test_each_splat_array: () -> untyped | ||
|
||
def test_each_keyword_arg: () -> untyped | ||
|
||
def test_each_keyword_arg_splat_record: () -> untyped | ||
|
||
def test_each_keyword_arg_splat_array: () -> untyped | ||
|
||
def test_forwarded_args: () -> untyped | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated from test/ast/ignore_test.rb with RBS::Inline | ||
|
||
class AST__IgnoreTest < Minitest::Test | ||
include TestHelper | ||
|
||
Ignore: untyped | ||
|
||
def parse: (untyped ruby) -> untyped | ||
|
||
def test_parse_ignore_start: () -> untyped | ||
|
||
def test_parse_ignore_end: () -> untyped | ||
|
||
def test_parse_ignore__empty: () -> untyped | ||
|
||
def test_parse_ignore__all: () -> untyped | ||
|
||
def test_parse_ignore__diagnostics: () -> untyped | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Generated from test/ast/node/type_application_test.rb with RBS::Inline | ||
|
||
class AST__Node__TypeApplicationTest < Minitest::Test | ||
include TestHelper | ||
|
||
include FactoryHelper | ||
|
||
include SubtypingHelper | ||
|
||
def buffer: (untyped string) -> untyped | ||
|
||
def test_one_type: () -> untyped | ||
|
||
def test_sequence_type: () -> untyped | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Generated from test/ast/node/type_assertion_test.rb with RBS::Inline | ||
|
||
class AST__Node__TypeAssertionTest < Minitest::Test | ||
include TestHelper | ||
|
||
include FactoryHelper | ||
|
||
include SubtypingHelper | ||
|
||
def buffer: (untyped string) -> untyped | ||
|
||
def test_type: () -> untyped | ||
|
||
def test_relative_type: () -> untyped | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
# Generated from test/block_params_test.rb with RBS::Inline | ||
|
||
class BlockParamsTest < Minitest::Test | ||
include TestHelper | ||
|
||
include FactoryHelper | ||
|
||
include SubtypingHelper | ||
|
||
BlockParams: untyped | ||
|
||
Params: untyped | ||
|
||
Types: untyped | ||
|
||
Namespace: untyped | ||
|
||
def block_params: (untyped src) -> untyped | ||
|
||
def test_1: () -> untyped | ||
|
||
def test_2: () -> untyped | ||
|
||
def test_zip1: () -> untyped | ||
|
||
def test_zip2: () -> untyped | ||
|
||
def test_zip3: () -> untyped | ||
|
||
def test_zip4: () -> untyped | ||
|
||
def test_zip_missing_required_params: () -> untyped | ||
|
||
def test_zip_with_extra_params: () -> untyped | ||
|
||
def test_zip_expand_array: () -> untyped | ||
|
||
def test_zip_expand_tuple: () -> untyped | ||
|
||
def test_param_type: () -> untyped | ||
|
||
def test_param_type_with_annotation: () -> untyped | ||
|
||
def test_param_type_with_hint: () -> untyped | ||
|
||
def param_type: (?required: untyped, ?optional: untyped, ?rest: untyped, ?required_keywords: untyped, ?optional_keywords: untyped, ?rest_keywords: untyped) -> untyped | ||
|
||
def test_zip_block: () -> untyped | ||
|
||
def test_multiple_param_parse: () -> untyped | ||
|
||
def test_multiple_param_zip: () -> untyped | ||
|
||
def test_zip_untyped: () -> untyped | ||
|
||
def test_unnamed: () -> untyped | ||
|
||
def test_unnamed_multi: () -> untyped | ||
end |
Oops, something went wrong.