Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

Commit

Permalink
Replace expect: with prints: syntax in text fixtures.
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanbeattie committed Jul 6, 2024
1 parent 89130d2 commit 1afbf4a
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 73 deletions.
14 changes: 7 additions & 7 deletions Starship/Rockstar.Test/TestCaseTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ public class TestCaseTest {
[Fact]
public void ExpectationExtractorExtractsExpectation() {
var expect = FixtureBase.ExtractExpects("""
shout "hello" (expect: hello\n)
shout "world" (expect: world\n)
shout "hello" (expect: hello\r\n)
shout "world" (expect: world\r\n)
""");
expect.ShouldBe("hello\nworld\n");
expect.ShouldBe("hello\nworld\n".ReplaceLineEndings());
}

[Fact]
Expand All @@ -16,18 +16,18 @@ public void ExpectationExtractorExtractsPrint() {
shout "hello" (prints: hello)
shout "world" (prints: 12345)
""");
expect.ShouldBe("hello\n12345\n");
expect.ShouldBe("hello\n12345\n".ReplaceLineEndings());
}

[Fact]
public void ExpectationExtractorExtractsExpectAndPrints() {
var expect = FixtureBase.ExtractExpects("""
shout "hello" (expect: hello\n)
shout "world" (expect: world\n)
shout "hello" (expect: hello\r\n)
shout "world" (expect: world\r\n)
shout "12345" (prints: 12345)
shout "67890" (prints: 67890)
""");
expect.ShouldBe("hello\nworld\n12345\n67890\n");
expect.ShouldBe("hello\nworld\n12345\n67890\n".ReplaceLineEndings());
}

}
10 changes: 5 additions & 5 deletions Starship/Rockstar.Test/fixtures/comments/complex_comments.rock
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
(expect: pass 1\n)
(prints: pass 1)
say "pass 1" (trailing comment)

(expect: pass 2\n)
(prints: pass 2)
(leading comment) say "pass 2"

(expect: pass 3\n)
(prints: pass 3)
say (inline comment) "pass 3"

(expect: pass 4\n)
(prints: pass 4)
(
multiline
comments
Expand All @@ -16,5 +16,5 @@ also
supported
) say "pass 4"

(expect: pass 5\n)
(prints: pass 5)
(((((((( multiple opening brackets are just part of the comment) say "pass 5"
6 changes: 3 additions & 3 deletions Starship/Rockstar.Test/fixtures/comments/simpleComments.rock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(comment on it's own)

say "the words" (comment at the end of a line) (expect: the words\n)
say "the words" (comment at the end of a line) (prints: the words)

say (comment between items) "you want to say" (expect: you want to say\n)
say (comment between items) "you want to say" (prints: you want to say)

(comment before items) say "whatever you want" (expect: whatever you want\n)
(comment before items) say "whatever you want" (prints: whatever you want)
4 changes: 2 additions & 2 deletions Starship/Rockstar.Test/fixtures/constants/constants.rock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
my heart is true
say my heart (expect: true\n)
say my heart (prints: true)

my love is false
say my love (expect: false\n)
say my love (prints: false)
10 changes: 5 additions & 5 deletions Starship/Rockstar.Test/fixtures/io/hello_number.rock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
say -123.45 (expect: -123.45\n)
say -1 (expect: -1\n)
say 0 (expect: 0\n)
say 1 (expect: 1\n)
say 123.45 (expect: 123.45\n)
say -123.45 (prints: -123.45)
say -1 (prints: -1)
say 0 (prints: 0)
say 1 (prints: 1)
say 123.45 (prints: 123.45)
6 changes: 3 additions & 3 deletions Starship/Rockstar.Test/fixtures/io/hello_world.rock
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Say "hello world" (expect: hello world\n)
Say "Hello World" (expect: Hello World\n)
SAY "HELLO WORLD" (expect: HELLO WORLD\n)
Say "hello world" (prints: hello world)
Say "Hello World" (prints: Hello World)
SAY "HELLO WORLD" (prints: HELLO WORLD)
30 changes: 15 additions & 15 deletions Starship/Rockstar.Test/fixtures/literals/literalAliases.rock
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
say mysterious (expect: mysterious\n)
say mysterious (prints: mysterious)

say null (expect: null\n)
say nothing (expect: null\n)
say nowhere (expect: null\n)
say nobody (expect: null\n)
say gone (expect: null\n)
say null (prints: null)
say nothing (prints: null)
say nowhere (prints: null)
say nobody (prints: null)
say gone (prints: null)

say empty (expect: \n)
say empty (prints: )

say true (expect: true\n)
say right (expect: true\n)
say yes (expect: true\n)
say ok (expect: true\n)
say true (prints: true)
say right (prints: true)
say yes (prints: true)
say ok (prints: true)

say false (expect: false\n)
say wrong (expect: false\n)
say no (expect: false\n)
say lies (expect: false\n)
say false (prints: false)
say wrong (prints: false)
say no (prints: false)
say lies (prints: false)
4 changes: 2 additions & 2 deletions Starship/Rockstar.Test/fixtures/literals/literalstrings.rock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(expect: What is not denied is permitted!\n)
(prints: What is not denied is permitted!)
Shout "What is not denied is permitted!"

(expect: This ain't not allowed!\n)
(prints: This ain't not allowed!)
Shout "This ain't not allowed!"
14 changes: 7 additions & 7 deletions Starship/Rockstar.Test/fixtures/math/operator_aliases.rock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
say 2 plus 2 (expect: 4\n)
say 2 with 2 (expect: 4\n)
say 5 minus 3 (expect: 2\n)
say 5 without 3 (expect: 2\n)
say 5 times 5 (expect: 25\n)
say 5 of 5 (expect: 25\n)
say 4 over 2 (expect: 2\n)
say 2 plus 2 (prints: 4)
say 2 with 2 (prints: 4)
say 5 minus 3 (prints: 2)
say 5 without 3 (prints: 2)
say 5 times 5 (prints: 25)
say 5 of 5 (prints: 25)
say 4 over 2 (prints: 2)


10 changes: 5 additions & 5 deletions Starship/Rockstar.Test/fixtures/math/operator_precedence.rock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
say 1 + 1 * 2 (expect: 3\n)
say 1 * 2 + 1 (expect: 3\n)
say 1 / 2 * 3 + 4 (expect: 5.5\n)
say 5-2*3 (expect: -1\n)
say 2*3 - 5 (expect: 1\n)
say 1 + 1 * 2 (prints: 3)
say 1 * 2 + 1 (prints: 3)
say 1 / 2 * 3 + 4 (prints: 5.5)
say 5-2*3 (prints: -1)
say 2*3 - 5 (prints: 1)

24 changes: 12 additions & 12 deletions Starship/Rockstar.Test/fixtures/math/operators.rock
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
say 1 + 1 (expect: 2\n)
say 5 + 10 (expect: 15\n)
say 2.5 + 2.5 (expect: 5\n)
say 1 + 0.2 + 0.03 (expect: 1.23\n)
say 1 + 1 (prints: 2)
say 5 + 10 (prints: 15)
say 2.5 + 2.5 (prints: 5)
say 1 + 0.2 + 0.03 (prints: 1.23)

say 2 - 1 (expect: 1\n)
say 0 - 1 (expect: -1\n)
say 1 - 0.5 (expect: 0.5\n)
say 2 - 1 (prints: 1)
say 0 - 1 (prints: -1)
say 1 - 0.5 (prints: 0.5)

say 1 * 0 (expect: 0\n)
say 1 * 1 (expect: 1\n)
say 1 * 2 (expect: 2\n)
say 2 * 2 (expect: 4\n)
say 1 * 0 (prints: 0)
say 1 * 1 (prints: 1)
say 1 * 2 (prints: 2)
say 2 * 2 (prints: 4)

say 1.000000000000 (expect: 1\n)
say 1.000000000000 (prints: 1)
4 changes: 2 additions & 2 deletions Starship/Rockstar.Test/fixtures/operators/short-circuit.rock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
say true or 1/0 (expect: true\n)
say false and 1/0 (expect: false\n)
say true or 1/0 (prints: true)
say false and 1/0 (prints: false)


Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


(this file tests that parsers can handle BLANK leading lines)
say "pass" (expect: pass\n)
say "pass" (prints: pass)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@


(this file tests that parsers can handle EMPTY leading lines)
say "pass" (expect: pass\n)
say "pass" (prints: pass)
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
(test whether parser can cope with a file that does not end with a new line)
say "pass" (expect: pass\n)
say "pass" (prints: pass)
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
say "pass" (expect: pass\n)
say "pass" (prints: pass)
(test we can cope with blank lines at the end of a file)

Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
say "pass" (expect: pass\n)
say "pass" (prints: pass)
(test we can cope with EMPTY lines - i.e. multiple newlines - at the end of a file)

0 comments on commit 1afbf4a

Please sign in to comment.