Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not equal when streams.readBool and peekBool compare true #11049

Closed
jiro4989 opened this issue Apr 17, 2019 · 1 comment
Closed

Not equal when streams.readBool and peekBool compare true #11049

jiro4989 opened this issue Apr 17, 2019 · 1 comment

Comments

@jiro4989
Copy link
Contributor

Return value of streams.readBool() and streams.peekBool() doesn't equal true.

Example

import streams

block:
  var strm = newStringStream("aaaaaaaaaaaaaaaaaa")
  echo strm.readBool()
  echo strm.readBool() == true
  echo strm.readBool() != false
  echo true == true
  strm.close()

echo "----------------------"

block:
  var strm = newStringStream("aaaaaaaaaaaaaaaaaa")
  echo strm.peekBool()
  echo strm.peekBool() == true
  echo strm.peekBool() != false
  echo true == true
  strm.close()

Current Output

true
false
true
true
----------------------
true
false
true
true

Expected Output

true
true
true
true
----------------------
true
true
true
true

Additional Information

$ nim -v
Nim Compiler Version 0.19.4 [Linux: amd64]
Compiled at 2019-02-01
Copyright (c) 2006-2018 by Andreas Rumpf

git hash: b6d96cafc8bcad1f3d32f2910b25cd11a93f7751
active boot switches: -d:release
@narimiran
Copy link
Member

narimiran commented Apr 17, 2019

Notice that it isn't false either ;)

block:
  var strm = newStringStream("aaaaaaaaaaaaaaaaaa")
  echo strm.peekBool()
  echo strm.peekBool() == true
  echo strm.peekBool() != true
  echo strm.peekBool() == false
  echo strm.peekBool() != false
  strm.close()
true
false
true
false
true

narimiran added a commit to narimiran/Nim that referenced this issue Apr 17, 2019
narimiran added a commit to narimiran/Nim that referenced this issue Apr 17, 2019
narimiran added a commit to narimiran/Nim that referenced this issue May 20, 2019
@Araq Araq closed this as completed in dc6a4b1 May 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants