nudge 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
@@ -57,6 +57,7 @@ module_eval <<'..end parse.y modeval..ida1760a43d7', 'parse.y', 22
|
|
57
57
|
|
58
58
|
def pop_footnote(category)
|
59
59
|
value = @footnotes[category].shift
|
60
|
+
return unless value
|
60
61
|
|
61
62
|
if category == "code"
|
62
63
|
embedded_footnotes = [""]
|
@@ -69,7 +70,7 @@ module_eval <<'..end parse.y modeval..ida1760a43d7', 'parse.y', 22
|
|
69
70
|
|
70
71
|
|
71
72
|
def collect_embedded_footnotes!(code_text, embedded_footnotes)
|
72
|
-
ss = StringScanner.new(code_text)
|
73
|
+
ss = StringScanner.new(code_text)
|
73
74
|
while ss.skip_until(/«([\p{Alpha}][\p{Alnum}_]*?)»/um)
|
74
75
|
category = ss[1]
|
75
76
|
footnote = @footnotes[category].shift || ""
|
@@ -77,6 +77,10 @@ describe "Nudge Program parsing" do
|
|
77
77
|
NudgeProgram.new("block {} «bar» 9 9").parses?.should == false
|
78
78
|
end
|
79
79
|
|
80
|
+
it "should work (not raise an exception) if the program is an empty string" do
|
81
|
+
NudgeProgram.new("").parses?.should == false
|
82
|
+
end
|
83
|
+
|
80
84
|
describe ": should have a #tidy attribute with the indented, one-point per line structure" do
|
81
85
|
it "should work for one-line programs" do
|
82
86
|
NudgeProgram.new("do int_add").tidy.should == "do int_add"
|
@@ -141,6 +141,12 @@ describe "Nudge Program parser" do
|
|
141
141
|
"block {\n value «code»\n value «code»\n value «int»} \n«code» do a\n«code»\n«int» 77"
|
142
142
|
end
|
143
143
|
|
144
|
+
it "should work for code missing footnotes entirely" do
|
145
|
+
troubl = "block {value «code»}"
|
146
|
+
lambda{NudgeTree.from(troubl)}.should_not raise_error
|
147
|
+
NudgeTree.from(troubl)[:tree].blueprint.should == "block {\n value «code»} \n«code»"
|
148
|
+
end
|
149
|
+
|
144
150
|
|
145
151
|
it "should strip whitespace off the front and back of footnote values" do
|
146
152
|
spacey = "value «code»\n«code» \t\t value «float» \t\t\n«float» \t\n1.234"
|