Coder Social home page Coder Social logo

eo-hamcrest's Introduction

eo-hamcrest's People

Contributors

c71n93 avatar graur avatar includealex avatar kerelape avatar levbagryansky avatar masynchin avatar maxonfjvipon avatar mikhaillipanin avatar mximp avatar renovate[bot] avatar rultor avatar yegor256 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

eo-hamcrest's Issues

assert-that.eo:253-255: Here we got an object printed...

The puzzle 17-30c88f18 from #17 has to be resolved:

# @todo #17:45min Here we got an object printed
# instead of data. The .map [i] i.as-string didn't work.
# We need to convert varargs to data[] somehow.

The puzzle was created by Graur Andrew on 12-Jun-22.

Estimate: 45 minutes, role: DEV.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.

incompatibility with 0.23.6

Current version of eo-hamcrest is not compatible with EO 0.23.6, because it uses char object, while it was removed in the latest EO.

eo 0.23.15

Version 0.23.15 has been release to Objectionary. I had to remove eo-hamcrest, since it didn't compile. Please, release a new version and submit a PR to Objectionary

new interface of "memory"

Since 0.23.7 the way we work with memory has changed. Now, we should do it like this:

memory 0 > x
x.write 42

We should update the version of EO in this lib and release again.

is-failed-output.eo:28-31: To add several tests for...

The puzzle 41-fa7f45be from #41 has to be resolved:

# @todo #41:30min To add several tests for checking
# is matcher output, when assert-that object return string
# and test suggestion is false. Check the origin ticket to get
# more information.

The puzzle was created by @Graur on 14-Sep-22.

Estimate: 30 minutes, role: DEV.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.

upgrade to 0.23.11

I had to remove eo-hamcrest from objectionary/home, since it's not compatible with 0.23.11. Please, fix the library, release it, and submit it to objectionary in a pull request.

Better way to output arrays

arrays are converted to String by .toString() method, which renders them unreadable

Example:

Expected: <Hello, друг!
> equal to value
     but: was <[B@3a7e45e7>

Proposal: use Arrays.toString() instead

Can it use decorator?

Can this code use decorator?

[matcher] > is
[a] > match
matcher.match a > @
[] > describe-mismatch
describe-mismatch. > @
matcher
[] > description-of
sprintf > @
"is %s"
description-of.
matcher

I am not an expert in EO, but I assume that it can be rewrite as:

[matcher] > is
  matcher > @

  [] > description-of
    sprintf > @
      "is %s"
      description-of.
        matcher

Let me know if I am wrong. If not, I can submit appropriate PR.

add test to check failed output message

We need more test to check how failed messages are look like

e.g.

[] > equal-to-int-failed-output
  [] > suggestion
    assert-that > @
      4
      $.equal-to 9
  eq. > @
    suggestion
    "\nExpected: <9> equal to value\n     but: was <4>"

mvn run failed

Yaml found at: .github/workflows/codecov.yml
    -> Found 1 reports
==> Detecting git/mercurial file structure
==> Reading reports
    - file not found at ./eo-parser/target/site/jacoco/jacoco.xml
--> No coverage data found.
    Please visit http://docs.codecov.io/docs/supported-languages
    search for your projects language to learn how to collect reports.
Error: Codecov failed with the following error: The process '/usr/bin/bash' failed with exit code 1

Hamcrest tries to access missing attribute in `list.is-empty`

The following error occurs when matching fails:

Caused by: org.eolang.ExFailure: Attribute failure at:
	list.is-empty≡EOorg.EOeolang.EOcollections.EOlist$EOis_emptyν2033691:{
	  ▸order=[]
		▸cached=NULL (hash=765284253)
		ρ=EOorg.EOeolang.EOcollections.EOlistν24:{
		  ▸order=[arr, is-empty, reducei, as-array, reduce, mapi, map, each, without, eq]
			▸cached=NULL (hash=351028485)
			ρ=Φ.org.eolang.collectionsS
			σ=ΦS
		}S
		σ=EOorg.EOeolang.EOcollections.EOlistν24:{
		  ▸order=[arr, is-empty, reducei, as-array, reduce, mapi, map, each, without, eq]
			▸cached=NULL (hash=351028485)
			ρ=Φ.org.eolang.collectionsS
			σ=ΦS
		}S
	}[#0=EOorg.EOeolang.EOhamcrest.EOassert_thatν16:{
		  ▸order=[actual, matcher, reasons, equal-to, not, all-of, any-of, greater-than, less-than, close-to, is, anything, described-as, has-item, has-items, array-each]
			▸cached=NULL (hash=1213349904)
			ρ=Φ.org.eolang.hamcrestS
			σ=ΦS
		}.reasons].if'[#0=EOorg.EOeolang.EOstringν25:{
		  ▸order=[eq, length, as-bytes, as-hash, slice]
			▸cached=NULL (hash=1259769769)
			Δ=ΦSF
			ρ=ΦS
			σ=ΦS
		}[Δ=""]][#1=EOorg.EOeolang.EOhamcrest.EOassert_thatν16:{
		  ▸order=[actual, matcher, reasons, equal-to, not, all-of, any-of, greater-than, less-than, close-to, is, anything, described-as, has-item, has-items, array-each]
			▸cached=NULL (hash=1213349904)
			ρ=Φ.org.eolang.hamcrestS
			σ=ΦS
		}.reasons.at'[#0=EOorg.EOeolang.EOintν28:{
			  ▸order=[eq, lt, lte, gt, gte, neg, plus, minus, times, div, as-bytes, as-hash]
				▸cached=NULL (hash=444920847)
				Δ=ΦSF
				ρ=ΦS
				σ=ΦS
			}[Δ=0]]]

anything-failed-output.eo:28-31: To add several tests for...

The puzzle 41-cc70864f from #41 has to be resolved:

# @todo #41:30min To add several tests for checking
# anything matcher output, when assert-that object return string
# and test suggestion is false. Check the origin ticket to get
# more information.

The puzzle was created by @Graur on 14-Sep-22.

Estimate: 30 minutes, role: DEV.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.

Change the behavior of the EO junit test to provide return text instead of false value

When junit test return string description (instead of false) we expect a readable message but got cannot cast java.lang.String to java.lang.Boolean, e.g.:

+package org.eolang.hamcrest
+alias org.eolang.hamcrest.assert-that
+junit

[] > two-numbers
  assert-that > @
    3.add 1
    $.equal-to 8
    "two numbers"

Expected console output message is something like:

two numbers
Expected: <8> but was <4>

5 not equals to 5

This is my code:

[] > delayed-calculation
  memory 0 > m
  [x] > inc
    seq > @
      m.write (m.plus x)
      m
  assert-that > @
    inc
      inc
        inc
          inc
            1
    $.equal-to 5

I'm getting:

[ERROR]   EOdelayed_calculationTest.testWorks:100
Expected: <5> equal to value
     but: was <5>

This is a pretty weird error message. How come 5 is not equal to 5?

wrong failure output when compare arrays

When:

[] > test
  assert-that > @
    * 1 2 3
    $.equal-to
      * - 1 -2

then:

Expected: <[Lorg.eolang.Phi;@3bd323e9> equal to value but: was <[Lorg.eolang.Phi;@4ff8d125>

assert-that.eo:256-258: Here we got an object printed...

The puzzle 3-30c88f18 from #3 has to be resolved:

# @todo #3:45min Here we got an object printed
# instead of data. The .map [i] i.as-string didn't work.
# We need to convert varargs to data[] somehow.

The puzzle was created by @Graur on 18-Jul-22.

Estimate: 45 minutes, role: DEV.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.

assert-that.eo:281-284: This string formatting doesn't...

The puzzle 37-c8e2717e from #37 has to be resolved:

# @todo #37:30min This string formatting doesn't work correctly.
# Here we got message like: [was <[Lorg.eolang.Phi;@1189dd52>]
# and possibly we need to change code below when string manipulation
# objects will be created.

The puzzle was created by Graur Andrew on 12-Jun-22.

Estimate: 30 minutes, role: DEV.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.

close-to-failed-output.eo:28-31: To add several tests for...

The puzzle 41-17873f95 from #41 has to be resolved:

# @todo #41:30min To add several tests for checking
# close-to matcher output, when assert-that object return string
# and test suggestion is false. Check the origin ticket to get
# more information.

The puzzle was created by graur on 14-Sep-22.

Estimate: 30 minutes, role: DEV.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.

assert-that object needed

We need to create assert-that.eo object in org.eolang.hamcrest. package. Which will be the main object for our hamcrest library.

Usage:

+package org.eolang
+alias org.eolang.hamcrest.assert-that
+junit

[] > first-test
  assert-that > @
    "sum of two numbers"
    4.add 4
    .equal-to 8
    .or
    .less-than 50

Text matchers implementation

We need to implement several main matchers, according to description in README.md file:
.equal-to-ignoring-case - test string equality ignoring case

.equal-to-ignoring-white-space - test string equality ignoring differences in runs of whitespace

.contains-string, .ends-with, .starts-with - test string matching

package-info.java is missing

We should add package-info.java to src/main/java/org/eolang/hamcrest directory and release a new version of the library. Without this file, EO runtime can't detect org.eolang.hamcrest as a package. It thinks it's a class.

not-failed-output.eo:28-31: To add several tests for...

The puzzle 41-bf856ca9 from #41 has to be resolved:

# @todo #41:30min To add several tests for checking
# not matcher output, when assert-that object return string
# and test suggestion is false. Check the origin ticket to get
# more information.

The puzzle was created by graur on 14-Sep-22.

Estimate: 30 minutes, role: DEV.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.

Hamcrest falls into stack overflow when missing attribute is addressed

Moved from here.

Test below test fails with stack overflow:

[] > invalid-test
  assert-that > @
    TRUE
    $.equals-to TRUE
[ERROR] EOorg.EOeolang.EOinvalid_testTest.testWorks  Time elapsed: 0.01 s  <<< ERROR!
java.lang.StackOverflowError
[ERROR]   EOinvalid_testTest>PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237->PhDefault.attr:237 » StackOverflow

Expected behaviour: something like Can't get(), attribute "equals-to" is absent among other attrs (ρ, minus, σ, lt, eq, gt, as-hash, plus, div, neg, times, Δ, as-bytes, gte, lte) and φ is absent

any-of-failed-output.eo:28-31: To add several tests for...

The puzzle 41-e26c967d from #41 has to be resolved:

# @todo #41:30min To add several tests for checking
# any-of matcher output, when assert-that object return string
# and test suggestion is false. Check the origin ticket to get
# more information.

The puzzle was created by @Graur on 14-Sep-22.

Estimate: 30 minutes, role: DEV.

If you have any technical questions, don't ask me, submit new tickets instead. The task will be "done" when the problem is fixed and the text of the puzzle is removed from the source code. Here is more about PDD and about me.

`all-of` and `any-of` didn't work properly

When:

+package org.eolang.hamcrest
+alias org.eolang.hamcrest.assert-that
+junit

[] > all-of-numbers-test
  assert-that > @
    150.sub 50
    $.all-of
      $.equal-to 100
      $.equal-to 100
    "all of numbers conditions"

an error occuried: You can't overwrite X

associated with: objectionary/eo#623

pdd rules failed with exception

I wasn't able to retrieve PDD puzzles from the code base and submit them to GitHub. If you think that it's a bug on our side, please submit it to [yegor256/0pdd](https://github.com/yegor256/0pdd/issues):

(): did not find expected key while parsing a block mapping at line 1 column 1

Please, copy and paste this stack trace to GitHub:

Psych::SyntaxError
(<unknown>): did not find expected key while parsing a block mapping at line 1 column 1
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/psych.rb:456:in `parse'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/psych.rb:456:in `parse_stream'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/psych.rb:390:in `parse'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/psych.rb:349:in `safe_load'
/app/objects/git_repo.rb:54:in `config'
/app/objects/job_emailed.rb:37:in `rescue in proceed'
/app/objects/job_emailed.rb:34:in `proceed'
/app/objects/job_commiterrors.rb:36:in `proceed'
/app/objects/job_detached.rb:48:in `exclusive'
/app/objects/job_detached.rb:36:in `block in proceed'
/app/objects/job_detached.rb:36:in `fork'
/app/objects/job_detached.rb:36:in `proceed'
/app/0pdd.rb:366:in `block in <top (required)>'

Hamcrest tries to access missing attribute `array.is-empty`

is-empty attributes has been recently moved to collections.list object.
However the lib still tries to use it in array:

# Main object for assertions
[actual matcher reasons...] > assert-that

  if. > @
    matcher.match actual
    TRUE
    sprintf
      "%s\nExpected: %s\n     but: %s"
      if.
        reasons.is-empty
...

assert-that object needs to be updated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.