Skip to content

Accept multiline block in an assertion (WIP) #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Accept multiline block in an assertion (WIP) #23

wants to merge 1 commit into from

Conversation

piroor
Copy link
Contributor

@piroor piroor commented Nov 21, 2017

I'm trying to support assertions with multiple lines block. How about this?


#20 の元々の問題は、長くなった行を読みやすさのために折り返しているとpower_assertでパースしてもらえないという点でした。
これについて、アドホックなやり方での対応を試みてみました。どうでしょうか?
現時点ですぐにマージしていただける物とは考えておらず、ひとまずご意見を頂けましたら幸いです。

基本的な考え方は、「1行をパースして失敗したら、次の行を足してパースし直す。これをパースに成功するまで繰り返す。」というものです。
そのため、現状でのデメリットとして、今までvalid_syntax?(str)falseと判定されていたケースで毎回ファイルの終端までの読み込みが行われてしまうため、テストの実行速度が低下することが懸念されます。
この問題についての有効な解決策はまだ思いついておりません。

@k-tsj
Copy link
Member

k-tsj commented Nov 23, 2017

Thanks your PR.

Ruby core team plans to implement new API to get position of AST node (https://bugs.ruby-lang.org/projects/ruby-trunk/wiki/Node-position-memo).
So I think power_assert should use it to support muliple lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants