[ruby/prism] Support offset

665f533373
This commit is contained in:
Kevin Newton 2024-03-11 10:09:10 -04:00 committed by git
parent a295eeba9d
commit 2ab75bc444
6 changed files with 76 additions and 12 deletions

View file

@ -231,6 +231,21 @@ module Prism
assert_equal 16, base[parse_expression("0x1")]
end
def test_offset
source = <<~RUBY
#!/bin/sh
echo "foo"
exit 0
#!/usr/bin/env ruby
puts "bar"
RUBY
assert Prism.parse_success?(source, offset: 30)
end
private
def parse_expression(source)