Skip to content

Commit

Permalink
fix id mode persistence after filter (fix #72)
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronjanse committed Mar 9, 2020
1 parent de1c37d commit eb8b177
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
4 changes: 2 additions & 2 deletions dots/states.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,12 @@ def next(self, char):
if self.parent.id == 0:
return DeadState(self.parent)
else:
return self
return TravelState(self.parent)
elif char == ';':
if self.parent.id == 1:
return DeadState(self.parent)
else:
return self
return TravelState(self.parent)
else:
return autodetect_next_state(self.parent, char)

Expand Down
7 changes: 7 additions & 0 deletions test/id_mode_persistence.dots
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
"Y"$\
"N"$~-.
.-#8@1@:{%}--{=}-/
.-#3-----/ |
|
.-#8@1@:-{%}--/
.-#3------/
4 changes: 4 additions & 0 deletions test/test_programs.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ def test_dots_filter_chars():
out = check_output('filter_chars', "END\n")
assert out == [0, 0, 1, 1]

def test_dots_id_mode_persistence():
out = check_output('id_mode_persistence')
assert out == map_add_newline("Y")

def test_dots_eof():
out = check_output('eof', "hi\n")
assert len(out) == 5

0 comments on commit eb8b177

Please sign in to comment.