Comments (4)
I've found two issues:
Hexdump::Type::Int#initialize
has asize
parameter. That usesInt32
instead of::Int32
, so it accidentally references theInt32
class below it.- The use of
.to be(nil)
doesn't behave correctly against value-types. In this instance,Endian
is nillable. Thebe
matcher uses the#same
method for comparison. But this is only found onNil
and reference types. Spectator has custom logic for values, but didn't handle nil and value types quite right. This has been fixed and pushed to master.
After addressing both of these issues, the spec passes.
Alternatively, for 2, be_nil
can be used in place of be(nil)
.
from spectator.
Could a special case be added for be(nil)
and Value types?
from spectator.
Could a special case be added for
be(nil)
and Value types?
Yup, one has been added and is on master.
from spectator.
I've made the suggested changes and updated spectator, but now I'm hitting this issue when using .to be(...)
to compare entries in a Hash.
TYPES = Hash(Symbol,Type).new
TYPES[:uint8] = Type::UInt8.new
TYPES[:byte] = TYPES[:uint8]
require "./spec_helper"
require "../src/hexdump/types"
Spectator.describe "Hexdump::TYPES" do
subject { Hexdump::TYPES }
describe "byte" do
it "must be an alias to uint8" do
expect(subject[:byte]).to be(subject[:uint8])
end
end
In spec/types_spec.cr:9:31
9 | expect(subject[:byte]).to be(subject[:uint8])
^-
Error: instantiating 'Spectator::Expectation::Target(Hexdump::Type)#to(Spectator::Matchers::ReferenceMatcher(Hexdump::Type))'
In lib/spectator/src/spectator/expectation.cr:104:7
104 | def to(matcher, message = nil) : Nil
^-
Error: instantiating 'to(Spectator::Matchers::ReferenceMatcher(Hexdump::Type), Nil)'
In lib/spectator/src/spectator/expectation.cr:105:30
105 | match_data = matcher.match(@expression)
^----
Error: instantiating 'Spectator::Matchers::ReferenceMatcher(Hexdump::Type)#match(Spectator::Expression(Hexdump::Type)+)'
In lib/spectator/src/spectator/matchers/standard_matcher.cr:27:10
27 | if match?(actual)
^-----
Error: instantiating 'match?(Spectator::Expression(Hexdump::Type)+)'
In lib/spectator/src/spectator/matchers/reference_matcher.cr:20:15
20 | value.same?(actual.value)
^----
Error: instantiating 'Hexdump::Type+#same?(Hexdump::Type+)'
In /var/lib/snapd/snap/crystal/793/share/crystal/src/reference.cr:29:5
29 | object_id == other.object_id
^--------
Error: instantiating 'object_id()'
In /var/lib/snapd/snap/crystal/793/share/crystal/src/primitives.cr:50:19
50 | def object_id : UInt64
^-----
Error: method Hexdump::Type+#object_id must return UInt64 but it is returning Hexdump::Type::UInt64
Hexdump::Type::UInt64 trace:
/var/lib/snapd/snap/crystal/793/share/crystal/src/primitives.cr:50
def object_id : UInt64
from spectator.
Related Issues (20)
- stub method(arg1,arg2,...) syntax seems to no longer work in 0.10/master HOT 3
- How to mock/stub IO::Memory#gets HOT 8
- Noticed line/column skew during incremental porting of RSpec files over to Spectator HOT 1
- Add RSpec's stub_const
- Better error when attempting to use string interpolation in it descriptions? HOT 11
- Problem with mock when using abstract class HOT 7
- Stubbed methods with default arguments not working HOT 3
- Mock not working for Process.run with block. HOT 10
- Runner filter -e tests equality instead of inclusion
- Example of custom matcher does not compile HOT 1
- Usage of keyword arguments as positional arguments in stubs HOT 1
- Mocks fail to compile for methods with free variables HOT 8
- Attempting to mock File results in error HOT 4
- Allow mocking libs
- Mocks on nameless splats HOT 2
- Re-run only failures HOT 1
- Segfault with nilable substring method call HOT 2
- `be_within` not respected during a `to have_received.with` check HOT 9
- subject with structs HOT 1
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.
from spectator.