From edd4ff21ba87bcc748ae88ce97534d751dca1c51 Mon Sep 17 00:00:00 2001
From: Michael Aaron Murphy <mmstickman@gmail.com>
Date: Fri, 6 Oct 2017 20:44:00 -0400
Subject: [PATCH] Fix integration tests

---
 examples/glob.out                | 4 ++--
 src/parser/shell_expand/words.rs | 7 +++----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/examples/glob.out b/examples/glob.out
index 75cbc78f..781affca 100644
--- a/examples/glob.out
+++ b/examples/glob.out
@@ -1,6 +1,6 @@
 Cargo.toml
 examples/braces.ion examples/braces.out examples/break.ion examples/break.out
-Cargo.toml l
+Cargo.toml
 Cargo.toml
 Cargo.lock Cargo.toml
 Cargo.toml
@@ -10,4 +10,4 @@ examples/else_if.ion examples/exists.ion examples/fail.ion examples/fibonacci.io
 [] []
 one three two
 three two
-three two one three two
+three two
diff --git a/src/parser/shell_expand/words.rs b/src/parser/shell_expand/words.rs
index 75ce36ff..f9b254d2 100644
--- a/src/parser/shell_expand/words.rs
+++ b/src/parser/shell_expand/words.rs
@@ -1,4 +1,3 @@
-
 use super::{expand_string, Expander};
 use super::{is_expression, slice};
 use super::ranges::parse_index_range;
@@ -1179,7 +1178,7 @@ impl<'a, E: Expander + 'a> WordIterator<'a, E> {
             for _ in 0..moves {
                 iterator.next();
             }
-            self.read += moves;
+            self.read += moves + 1;
             true
         } else {
             self.read += 1;
@@ -1278,7 +1277,7 @@ impl<'a, E: Expander + 'a> Iterator for WordIterator<'a, E> {
                         self.read += 1;
                         return Some(self.braces(&mut iterator));
                     }
-                    b'[' if !self.flags.contains(SQUOTE | DQUOTE) => if self.glob_check(&mut iterator) {
+                    b'[' if !self.flags.intersects(SQUOTE | DQUOTE) => if self.glob_check(&mut iterator) {
                         glob = true;
                     } else {
                         return Some(self.array(&mut iterator));
@@ -1398,7 +1397,7 @@ impl<'a, E: Expander + 'a> Iterator for WordIterator<'a, E> {
                         return self.next();
                     };
                 }
-                b'[' if !self.flags.contains(SQUOTE | DQUOTE) => if self.glob_check(&mut iterator) {
+                b'[' if !self.flags.intersects(SQUOTE | DQUOTE) => if self.glob_check(&mut iterator) {
                     glob = true;
                 } else {
                     return Some(WordToken::Normal(&self.data[start..self.read], glob, tilde));
-- 
GitLab