test/test_source.rb in pdd-0.19.1 vs test/test_source.rb in pdd-0.19.2
- old
+ new
@@ -32,15 +32,15 @@
Dir.mktmpdir 'test' do |dir|
file = File.join(dir, 'a.txt')
File.write(
file,
"
- * @todo #44 hello,
+ * \x40todo #44 hello,
* how are you\t\r\tdoing?
* -something else
Something else
- ~~ @todo #ABC-3 this is another puzzle
+ ~~ \x40todo #ABC-3 this is another puzzle
~~ and it also has to work
"
)
list = PDD::VerboseSource.new(file, PDD::Source.new(file, 'hey')).puzzles
assert_equal 2, list.size
@@ -57,14 +57,14 @@
def test_failing_on_invalid_puzzle
Dir.mktmpdir 'test' do |dir|
file = File.join(dir, 'a.txt')
File.write(
file,
- '
- * @todo #44 this is an incorrectly formatted puzzle,
+ "
+ * \x40todo #44 this is an incorrectly formatted puzzle,
* with a second line without a leading space
- '
+ "
)
error = assert_raises PDD::Error do
PDD::VerboseSource.new(file, PDD::Source.new(file, 'hey')).puzzles
end
assert !error.message.index('Space expected').nil?
@@ -74,26 +74,26 @@
def test_failing_on_incomplete_puzzle
Dir.mktmpdir 't5' do |dir|
file = File.join(dir, 'ff.txt')
File.write(
file,
- '
- * @todo this puzzle misses ticket name/number
- '
+ "
+ * \x40todo this puzzle misses ticket name/number
+ "
)
error = assert_raises PDD::Error do
PDD::VerboseSource.new(file, PDD::Source.new(file, 'ff')).puzzles
end
- assert !error.to_s.index('TODO is not followed by a puzzle marker').nil?
+ assert !error.to_s.index("\x40todo is not followed by").nil?
end
end
def test_failing_on_broken_unicode
skip if Gem.win_platform?
Dir.mktmpdir 'test' do |dir|
file = File.join(dir, 'xx.txt')
- File.write(file, ' * @todo #44 this is a broken unicode: ' + 0x92.chr)
+ File.write(file, ' * \x40todo #44 this is a broken unicode: ' + 0x92.chr)
assert_raises PDD::Error do
PDD::VerboseSource.new(file, PDD::Source.new(file, 'xx')).puzzles
end
end
end
@@ -103,11 +103,11 @@
Dir.mktmpdir 'test' do |dir|
file = File.join(dir, 'a.txt')
File.write(
file,
'
- * @todo 44 this puzzle is not formatted correctly
+ * \x40todo 44 this puzzle is not formatted correctly
'
)
error = assert_raises PDD::Error do
PDD::VerboseSource.new(file, PDD::Source.new(file, 'hey')).puzzles
end
@@ -118,18 +118,18 @@
def test_failing_on_puzzle_without_leading_space
Dir.mktmpdir 'test' do |dir|
file = File.join(dir, 'hey.txt')
File.write(
file,
- '
- *@todo #999 this is an incorrectly formatted puzzle!
- '
+ "
+ *\x40todo #999 this is an incorrectly formatted puzzle!
+ "
)
error = assert_raises PDD::Error do
PDD::VerboseSource.new(file, PDD::Source.new(file, 'x')).puzzles
end
- assert !error.message.index('TODO must have a leading space').nil?
+ assert !error.message.index("\x40todo must have a leading space").nil?
end
end
def test_reads_git_author
skip if Gem.win_platform?
@@ -138,10 +138,10 @@
set -e
cd '#{dir}'
git init --quiet .
git config user.email test@teamed.io
git config user.name test
- echo '@todo #1 this is the puzzle' > a.txt
+ echo '\x40todo #1 this is the puzzle' > a.txt
git add a.txt
git commit --quiet -am 'first version'
")
list = PDD::Source.new(File.join(dir, 'a.txt'), '').puzzles
assert_equal 1, list.size