rcat's People
Forkers
jeg2 chopmo markus1189 bracksun moniyax ngpestelos marlonglopes retornam jmhend craigmcdonald ayumi-b bhudgens gabefinch gosom cutiefun kaushikvinaytg robertsapunarich alexandre-rubanrcat's Issues
Test cat -ns == rcat -ns Fails on Linux Mint 18.1
Hey, I'm really digging your tutorial! I tried to run the test file, and if was failing because rcat -ns was not behaving like cat -ns.
➜ rcat git:(master) ✗ cat /etc/linuxmint/info | grep GRUB_TITLE
GRUB_TITLE=Linux Mint 18.1 Cinnamon 64-bit
➜ rcat git:(master) ✗ ruby tests.rb
tests.rb:81:in `<main>': Failed 'cat -ns [f1 f2] == rcat -ns [f1 f2]' (RuntimeError)
➜ rcat git:(master) ✗ cat -ns data/gettysburg.txt data/spaced_out.txt
1 Four score and seven years ago our fathers brought forth on this continent, a
2 new nation, conceived in Liberty, and dedicated to the proposition that all men
3 are created equal.
4
5 Now we are engaged in a great civil war, testing whether that nation, or any
6 nation so conceived and so dedicated, can long endure. We are met on a great
7 battle-field of that war. We have come to dedicate a portion of that field, as a
8 final resting place for those who here gave their lives that that nation might
9 live. It is altogether fitting and proper that we should do this.
10
11 But, in a larger sense, we can not dedicate -- we can not consecrate -- we can
12 not hallow -- this ground. The brave men, living and dead, who struggled here,
13 have consecrated it, far above our poor power to add or detract. The world will
14 little note, nor long remember what we say here, but it can never forget what
15 they did here. It is for us the living, rather, to be dedicated here to the
16 unfinished work which they who fought here have thus far so nobly advanced. It
17 is rather for us to be here dedicated to the great task remaining before us --
18 that from these honored dead we take increased devotion to that cause for which
19 they gave the last full measure of devotion -- that we here highly resolve that
20 these dead shall not have died in vain -- that this nation, under God, shall
21 have a new birth of freedom -- and that government of the people, by the people,
22 for the people, shall not perish from the earth.
23 Now we are engaged in a great civil war, testing whether that nation, or any
24
25 nation so conceived and so dedicated, can long endure. We are met on a great
26
27 battle-field of that war. We have come to dedicate a portion of that field, as a
28
29 final resting place for those who here gave their lives that that nation might
30
31 live. It is altogether fitting and proper that we should do this.
➜ rcat git:(master) ✗ rcat -ns data/gettysburg.txt data/spaced_out.txt
1 Four score and seven years ago our fathers brought forth on this continent, a
2 new nation, conceived in Liberty, and dedicated to the proposition that all men
3 are created equal.
4
5 Now we are engaged in a great civil war, testing whether that nation, or any
6 nation so conceived and so dedicated, can long endure. We are met on a great
7 battle-field of that war. We have come to dedicate a portion of that field, as a
8 final resting place for those who here gave their lives that that nation might
9 live. It is altogether fitting and proper that we should do this.
10
11 But, in a larger sense, we can not dedicate -- we can not consecrate -- we can
12 not hallow -- this ground. The brave men, living and dead, who struggled here,
13 have consecrated it, far above our poor power to add or detract. The world will
14 little note, nor long remember what we say here, but it can never forget what
15 they did here. It is for us the living, rather, to be dedicated here to the
16 unfinished work which they who fought here have thus far so nobly advanced. It
17 is rather for us to be here dedicated to the great task remaining before us --
18 that from these honored dead we take increased devotion to that cause for which
19 they gave the last full measure of devotion -- that we here highly resolve that
20 these dead shall not have died in vain -- that this nation, under God, shall
21 have a new birth of freedom -- and that government of the people, by the people,
22 for the people, shall not perish from the earth.
1 Now we are engaged in a great civil war, testing whether that nation, or any
2
3 nation so conceived and so dedicated, can long endure. We are met on a great
4
5 battle-field of that war. We have come to dedicate a portion of that field, as a
6
7 final resting place for those who here gave their lives that that nation might
8
9 live. It is altogether fitting and proper that we should do this.
➜ rcat git:(master) ✗
The issue seemed to be that the @line_number in the Display class was being set to 1 on the calls to render, instead of in the constructor. Moving that initialization passed the tests on my system!
module RCat
class Display
def initialize(params)
@line_numbering_style = params[:line_numbering_style]
@squeeze_extra_newlines = params[:squeeze_extra_newlines]
@line_number = 1 # works here!
end
def render(data)
# Causes -ns to fail
# @line_number = 1
#lines is an enumerator
lines = data.each_line
loop { render_line(lines) }
end
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.