Add source class

This commit is contained in:
Michael Miller 2019-02-17 12:25:23 -07:00
parent 04bccd162e
commit dc66b184e2
2 changed files with 23 additions and 0 deletions

View file

@ -42,4 +42,5 @@ require "./pending_result"
require "./failed_result"
require "./errored_result"
require "./source"
require "./example_iterator"

22
src/spectator/source.cr Normal file
View file

@ -0,0 +1,22 @@
module Spectator
# Define the file and line number something originated from.
struct Source
# Absolute file path.
getter file : String
# Line number in the file.
getter line : Int32
# Creates the source.
def initialize(@file, @line)
end
# String representation of the source.
# This is formatted as `FILE:LINE`.
def to_s(io)
io << file
io << ':'
io << line
end
end
end