Skip to content
This repository has been archived by the owner on Jul 17, 2024. It is now read-only.

Commit

Permalink
Merge pull request #42 from objectionary/6
Browse files Browse the repository at this point in the history
introduce .array-each object
  • Loading branch information
Graur committed May 25, 2022
2 parents 5c4e338 + a74fb0e commit 195efcd
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 7 deletions.
6 changes: 2 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,6 @@ SOFTWARE.
<id>1</id>
<name>Andrew Graur</name>
<email>graur.andrew@gmail.com</email>
<organization>yegor256.com</organization>
<organizationUrl>https://www.yegor256.com</organizationUrl>
<roles>
<role>Developer</role>
</roles>
Expand Down Expand Up @@ -84,7 +82,7 @@ SOFTWARE.
<dependency>
<groupId>org.eolang</groupId>
<artifactId>eo-runtime</artifactId>
<version>0.23.4</version>
<version>0.23.5</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand All @@ -104,7 +102,7 @@ SOFTWARE.
<plugin>
<groupId>org.eolang</groupId>
<artifactId>eo-maven-plugin</artifactId>
<version>0.23.4</version>
<version>0.23.5</version>
<executions>
<execution>
<id>compile</id>
Expand Down
46 changes: 44 additions & 2 deletions src/main/eo/org/eolang/hamcrest/assert-that.eo
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@
TRUE
seq
mismatches.write
mismatches.append
mismatches.with
matcher.describe-mismatch
FALSE
seq > @
Expand Down Expand Up @@ -319,7 +319,7 @@
count.write (i.add 1)
seq
mismatches.write
mismatches.append
mismatches.with
describe-mismatch.
matchers.get i
count.write -1
Expand All @@ -346,3 +346,45 @@
matchers
[i]
i.description-of > @

[matchers...] > array-each

memory > mismatches

[] > check-length
eq. > @
matchers.length
actual.length

[a] > match
if. > @
check-length
seq
mismatches.write *
a.reducei
TRUE
[acc i el]
and. > @
acc
if.
(matchers.get i).match el
TRUE
seq
mismatches.write
mismatches.with
describe-mismatch.
matchers.get i
FALSE
FALSE

[] > describe-mismatch
sprintf > @
"mismatches: [%s]"
", ".joined mismatches

[] > description-of
" and ".joined > @
map.
matchers
[i]
i.description-of > @
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,20 @@
assert-that > @
* "a" "b" "c" 'd'
$.has-items
$.equal-to "c"
$.equal-to "c"

[] > arrays-each-items
assert-that > @
* 1 2
$.array-each
$.equal-to 1
$.equal-to 2

[] > arrays-each-items-complex-case
assert-that > @
* "vice" 'c' -5 (13.as-float)
$.array-each
$.equal-to "vice"
$.equal-to 'c'
$.less-than 0
$.greater-than 10.0

1 comment on commit 195efcd

@0pdd
Copy link

@0pdd 0pdd commented on 195efcd May 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

(): 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)>'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1675:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1675:in `block in compile!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1013:in `block (3 levels) in route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1032:in `route_eval'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1013:in `block (2 levels) in route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1061:in `block in process_route'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1059:in `catch'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1059:in `process_route'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1011:in `block in route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1008:in `each'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1008:in `route!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1129:in `block in dispatch!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `block in invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `catch'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1124:in `dispatch!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:939:in `block in call!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `block in invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `catch'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1101:in `invoke'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:939:in `call!'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:929:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/xss_header.rb:18:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/path_traversal.rb:16:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/json_csrf.rb:26:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/base.rb:50:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/base.rb:50:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-protection-2.1.0/lib/rack/protection/frame_options.rb:31:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/logger.rb:17:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/common_logger.rb:38:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:253:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:246:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/head.rb:12:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/method_override.rb:24:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:216:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1991:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1542:in `block in call'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1769:in `synchronize'
/app/vendor/bundle/ruby/2.6.0/gems/sinatra-2.1.0/lib/sinatra/base.rb:1542:in `call'
/app/vendor/bundle/ruby/2.6.0/gems/rack-2.2.3/lib/rack/handler/webrick.rb:95:in `service'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/webrick/httpserver.rb:140:in `service'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/webrick/httpserver.rb:96:in `run'
/app/vendor/ruby-2.6.0/lib/ruby/2.6.0/webrick/server.rb:307:in `block in start_thread'

Please sign in to comment.