Skip to content

Commit

Permalink
change to many up to newline, and update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rvantonder committed Sep 17, 2019
1 parent 40998ca commit a8ee915
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/matchers/matcher.ml
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ module Make (Syntax : Syntax.S) (Info : Info.S) = struct

| Hole Line (identifier, _dimension) ->
let allowed =
let allowed = many1 (is_not (char '\n')) in
let allowed = many (is_not (char '\n')) in
allowed >>= fun x -> return [(String.of_char_list x)^"\n"]
in
let hole_semantics = allowed << char '\n' in
Expand Down
17 changes: 15 additions & 2 deletions test/test_hole_extensions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,25 @@ derp
let match_template = {|:[x\n]|} in
let rewrite_template = {|{:[x]}|} in
run source match_template rewrite_template;
[%expect_exact {|
{foo.
[%expect_exact {|{
}{foo.
}{foo.bar.quux
}{derp
}|}]

let%expect_test "match_empty_in_newline_hole" =
let run = run_all in
let source =
{|stuff
after
|} in
let match_template = {|stuff:[x\n]|} in
let rewrite_template = {|{->:[x]<-}|} in
run source match_template rewrite_template;
[%expect_exact {|{->
<-}after
|}]

let%expect_test "leading_indentation" =
let run = run_all in
let source =
Expand Down

0 comments on commit a8ee915

Please sign in to comment.