Skip to content

Commit

Permalink
ne: improve test
Browse files Browse the repository at this point in the history
Rewrite test in a more human readable way.
  • Loading branch information
zmwangx committed Sep 18, 2016
1 parent d8133bf commit d2b36e1
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions Formula/ne.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,21 @@ def install

test do
ENV["TERM"] = "xterm"
(testpath/"test.txt").write("This is a test document.\n")
(testpath/"test_ne").write("GotoLine 2\nInsertString line 2\nExit\n")
system "script", "-q", "/dev/null", "#{bin}/ne", "--macro", ((testpath/"test_ne")).to_s, ((testpath/"test.txt")).to_s
assert_equal "This is a test document.\nline 2", File.read("#{testpath}/test.txt")
document = testpath/"test.txt"
macros = testpath/"macros"
document.write <<-EOS.undent
This is a test document.
EOS
macros.write <<-EOS.undent
GotoLine 2
InsertString line 2
InsertLine
Exit
EOS
system "script", "-q", "/dev/null", bin/"ne", "--macro", macros, document
assert_equal <<-EOS.undent, document.read
This is a test document.
line 2
EOS
end
end

0 comments on commit d2b36e1

Please sign in to comment.