Skip to content

Commit

Permalink
Fix bug #231
Browse files Browse the repository at this point in the history
  • Loading branch information
olabini committed Apr 22, 2009
1 parent 2b671ba commit 0255cf4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/ikc/main/Ioke.Lang/Text.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public override void Init(IokeObject obj) {

obj.Kind = "Text";
obj.Mimics(IokeObject.As(runtime.Mixins.GetCell(null, null, "Comparing"), null), runtime.nul, runtime.nul);
obj.SetCell("==", runtime.Base.Cells["=="]);

obj.RegisterMethod(runtime.NewNativeMethod("Returns a text representation of the object",
new NativeMethod.WithNoArguments("asText",
Expand Down
1 change: 1 addition & 0 deletions src/ikj/main/ioke/lang/Text.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public void init(IokeObject obj) throws ControlFlow {

obj.setKind("Text");
obj.mimics(IokeObject.as(obj.runtime.mixins.getCell(null, null, "Comparing"), null), obj.runtime.nul, obj.runtime.nul);
obj.setCell("==", runtime.base.getCells().get("=="));

obj.registerMethod(obj.runtime.newNativeMethod("Returns a text representation of the object", new NativeMethod.WithNoArguments("asText") {
@Override
Expand Down
12 changes: 12 additions & 0 deletions test/text_spec.ik
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,18 @@ describe("Text",
it("should work correctly when comparing another kind",
"foo" should not == Base mimic
)

it("should not return true for equality with other types",
"true" should not == true
"true" should not == false
"true" should not == nil
"false" should not == false
"false" should not == true
"false" should not == nil
"nil" should not == nil
"nil" should not == false
"nil" should not == true
)
)

describe("===",
Expand Down

0 comments on commit 0255cf4

Please sign in to comment.