From 3be35bd51bc95aedc37787ecffefc3c3b7c06a2f Mon Sep 17 00:00:00 2001 From: maiha Date: Fri, 6 Jan 2017 22:02:08 +0900 Subject: [PATCH] Specs 127 (107 successes, 0 failures, 20 pending) Examples 1195 (1011 successes, 0 failures, 184 pending) --- .travis.yml | 3 +- Makefile | 17 ++++++-- README.md | 14 +++++-- doc/compile/cache | 7 ++++ doc/compile/log | 2 +- doc/spec/cache | 15 +++---- doc/spec/example_cnt_ng | 2 +- doc/spec/example_cnt_ok | 2 +- doc/spec/example_cnt_ok_all | 2 +- doc/spec/example_cnt_ok_pending | 2 +- doc/spec/example_cnt_pending | 2 +- doc/spec/fixtures | 31 +++++++-------- doc/spec/log | 14 +------ doc/spec/ng | 1 - doc/spec/ok | 1 + examples/array/007.cr | 4 +- examples/array/008.cr | 4 +- examples/array/026.cr | 8 ++-- examples/array/034.cr | 8 ++-- examples/array/048.cr | 2 +- examples/array/051.cr | 2 +- examples/array/052.cr | 2 +- examples/array/053.cr | 2 +- examples/array/054.cr | 2 +- examples/array/055.cr | 2 +- examples/array/056.cr | 2 +- examples/array/057.cr | 2 +- examples/array/058.cr | 2 +- examples/array/059.cr | 2 +- examples/array/060.cr | 2 +- examples/array/061.cr | 2 +- examples/array/062.cr | 2 +- examples/array/063.cr | 2 +- examples/array/064.cr | 2 +- examples/array/065.cr | 2 +- examples/array/066.cr | 2 +- examples/array/067.cr | 2 +- examples/array/068.cr | 2 +- examples/array/all.cr | 62 ++++++++++++++--------------- examples/big/big_int/003.cr | 2 +- examples/big/big_int/004.cr | 6 +-- examples/big/big_int/all.cr | 8 ++-- examples/bit_array/005.cr | 2 +- examples/bit_array/all.cr | 2 +- examples/enum/005.cr | 2 +- examples/enum/006.cr | 2 +- examples/enum/016.cr | 2 +- examples/enum/017.cr | 2 +- examples/enum/018.cr | 2 +- examples/enum/019.cr | 2 +- examples/enum/020.cr | 2 +- examples/enum/021.cr | 2 +- examples/enum/022.cr | 2 +- examples/enum/023.cr | 2 +- examples/enum/024.cr | 2 +- examples/enum/025.cr | 2 +- examples/enum/026.cr | 2 +- examples/enum/027.cr | 2 +- examples/enum/028.cr | 2 +- examples/enum/all.cr | 30 +++++++------- examples/hash/016.cr | 2 +- examples/hash/017.cr | 2 +- examples/hash/018.cr | 2 +- examples/hash/019.cr | 2 +- examples/hash/020.cr | 2 +- examples/hash/021.cr | 2 +- examples/hash/022.cr | 2 +- examples/hash/023.cr | 2 +- examples/hash/024.cr | 2 +- examples/hash/025.cr | 2 +- examples/hash/026.cr | 2 +- examples/hash/027.cr | 2 +- examples/hash/028.cr | 2 +- examples/hash/029.cr | 2 +- examples/hash/030.cr | 2 +- examples/hash/031.cr | 2 +- examples/hash/032.cr | 2 +- examples/hash/033.cr | 2 +- examples/hash/034.cr | 2 +- examples/hash/035.cr | 2 +- examples/hash/036.cr | 2 +- examples/hash/037.cr | 2 +- examples/hash/038.cr | 2 +- examples/hash/039.cr | 2 +- examples/hash/040.cr | 2 +- examples/hash/041.cr | 2 +- examples/hash/042.cr | 2 +- examples/hash/043.cr | 2 +- examples/hash/044.cr | 2 +- examples/hash/all.cr | 58 +++++++++++++-------------- examples/html/002.cr | 2 +- examples/html/all.cr | 2 +- examples/http/headers/001.cr | 2 +- examples/http/headers/all.cr | 2 +- examples/indexable/010.cr | 2 +- examples/indexable/011.cr | 2 +- examples/indexable/012.cr | 2 +- examples/indexable/013.cr | 2 +- examples/indexable/014.cr | 2 +- examples/indexable/015.cr | 2 +- examples/indexable/016.cr | 2 +- examples/indexable/017.cr | 2 +- examples/indexable/018.cr | 2 +- examples/indexable/019.cr | 2 +- examples/indexable/020.cr | 2 +- examples/indexable/021.cr | 2 +- examples/indexable/022.cr | 2 +- examples/indexable/023.cr | 2 +- examples/indexable/024.cr | 2 +- examples/indexable/all.cr | 30 +++++++------- examples/int/012.cr | 2 +- examples/int/all.cr | 2 +- examples/kernel/002.cr | 2 +- examples/kernel/003.cr | 2 +- examples/kernel/all.cr | 4 +- examples/named_tuple/015.cr | 2 +- examples/named_tuple/016.cr | 2 +- examples/named_tuple/017.cr | 2 +- examples/named_tuple/018.cr | 2 +- examples/named_tuple/019.cr | 2 +- examples/named_tuple/020.cr | 2 +- examples/named_tuple/021.cr | 2 +- examples/named_tuple/022.cr | 2 +- examples/named_tuple/023.cr | 2 +- examples/named_tuple/all.cr | 18 ++++----- examples/pointer/001.cr | 2 +- examples/pointer/all.cr | 2 +- examples/range/009.cr | 2 +- examples/range/010.cr | 2 +- examples/range/011.cr | 2 +- examples/range/012.cr | 2 +- examples/range/013.cr | 2 +- examples/range/014.cr | 2 +- examples/range/015.cr | 2 +- examples/range/016.cr | 2 +- examples/range/all.cr | 16 ++++---- examples/set/011.cr | 2 +- examples/set/012.cr | 2 +- examples/set/013.cr | 2 +- examples/set/014.cr | 2 +- examples/set/015.cr | 2 +- examples/set/016.cr | 2 +- examples/set/017.cr | 2 +- examples/set/018.cr | 2 +- examples/set/019.cr | 2 +- examples/set/020.cr | 2 +- examples/set/021.cr | 2 +- examples/set/022.cr | 2 +- examples/set/023.cr | 2 +- examples/set/024.cr | 2 +- examples/set/all.cr | 28 ++++++------- examples/static_array/009.cr | 2 +- examples/static_array/all.cr | 2 +- examples/string/103.cr | 2 +- examples/string/104.cr | 2 +- examples/string/105.cr | 2 +- examples/string/106.cr | 2 +- examples/string/107.cr | 2 +- examples/string/108.cr | 2 +- examples/string/109.cr | 2 +- examples/string/110.cr | 2 +- examples/string/111.cr | 2 +- examples/string/112.cr | 2 +- examples/string/113.cr | 2 +- examples/string/all.cr | 22 +++++----- examples/tuple/013.cr | 2 +- examples/tuple/014.cr | 2 +- examples/tuple/015.cr | 2 +- examples/tuple/016.cr | 2 +- examples/tuple/017.cr | 2 +- examples/tuple/018.cr | 2 +- examples/tuple/019.cr | 2 +- examples/tuple/020.cr | 2 +- examples/tuple/021.cr | 2 +- examples/tuple/022.cr | 2 +- examples/tuple/023.cr | 2 +- examples/tuple/024.cr | 2 +- examples/tuple/025.cr | 2 +- examples/tuple/026.cr | 2 +- examples/tuple/027.cr | 2 +- examples/tuple/all.cr | 30 +++++++------- gen/spec/array_spec.cr | 62 ++++++++++++++--------------- gen/spec/enum_spec.cr | 30 +++++++------- gen/spec/hash_spec.cr | 58 +++++++++++++-------------- gen/spec/html_spec.cr | 2 +- gen/spec/http/headers_spec.cr | 2 +- gen/spec/indexable_spec.cr | 30 +++++++------- gen/spec/int_spec.cr | 2 +- gen/spec/kernel_spec.cr | 4 +- gen/spec/named_tuple_spec.cr | 18 ++++----- gen/spec/nil_spec.cr | 2 +- gen/spec/pointer_spec.cr | 2 +- gen/spec/range_spec.cr | 16 ++++---- gen/spec/set_spec.cr | 28 ++++++------- gen/spec/static_array_spec.cr | 2 +- gen/spec/string_spec.cr | 26 ++++++------ gen/spec/tuple_spec.cr | 30 +++++++------- shard.yml | 2 +- src/examples/generator/generator.cr | 2 +- src/examples/generator/rules.cr | 1 + 200 files changed, 541 insertions(+), 529 deletions(-) diff --git a/.travis.yml b/.travis.yml index 07ae20ed..5c18942d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,5 +2,6 @@ language: crystal sudo: false script: - make test - - make gen_spec + - make generated_spec - make status + - make spec_succeeded diff --git a/Makefile b/Makefile index e1f248a5..b67b52a5 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ DOCKER_RUN = docker run --rm $(DOCKER_MOUNT) -w /tmp -e LIBRARY_PATH="/opt/cryst all: ${PROG} -test: spec ${PROG} version +test: version spec clean ${PROG} gen docker_spec status_bang ${PROG}: src/bin/main.cr crystal build $^ -o ${PROG} ${LINK_FLAGS} @@ -47,8 +47,8 @@ spec: trusted_spec: crystal spec -v gen/trusted/ -.PHONY : gen_spec -gen_spec: +.PHONY : generated_spec +generated_spec: @rm -f $(DOC_SPEC_OK) $(DOC_SPEC_NG) @touch $(DOC_SPEC_OK) $(DOC_SPEC_NG) @for x in $(GEN_SPEC_SRCS) ; do\ @@ -98,7 +98,7 @@ docker: $(DOCKER_RUN) -it $(DOCKER_IMAGE) bash .PHONY : status -status: status_spec status_example status_compile +status: status_spec status_example .PHONY : status_spec status_spec: @@ -136,3 +136,12 @@ status_compile: .PHONY : gen_fixtures gen_fixtures: find examples/ -type f | xargs cat | grep '^[^ #].*#' | sort | uniq > $(DOC_FIXTURES) + + +# check all generated spec succeeded for travis result +.PHONY : spec_succeeded +spec_succeeded: + @test `wc -l < $(DOC_SPEC_NG)` = 0 + +.PHONY : status_bang +status_bang: status spec_succeeded diff --git a/README.md b/README.md index d300315a..9436886d 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,11 @@ make ln -s /opt/crystal . ``` +- prepare docker image when you want to run spec in docker. +```shell +docker pull jhass/crystal-build-x86_64 +``` + ## Usage #### `make check` # scan and count examples @@ -35,6 +40,8 @@ ln -s /opt/crystal . - [doc/spec/log](./doc/spec/log) # last result - [doc/spec/cache](./doc/spec/cache) # Delete this to re-spec all +#### `make test` # Run all at once: `spec`, `gen`, `docker_spec` + ## Pending controls #### not wanted to generate codes @@ -60,13 +67,13 @@ Please be careful and check the code before run. - executes unit tests about this application itself -#### `make gen_spec` (should be used in TravisCI or docker) (!!!DANGER!!!) +#### `make generated_spec` (should be used in TravisCI or docker) (!!!DANGER!!!) - executes generated spec files filtered by `gen/skip` in current host. #### `make docker_spec` -- executes same as `gen_spec` except running in docker containers. +- executes same as `generated_spec` except running in docker containers. (needs docker image: see `DOCKER_IMAGE` in **Makefile**) #### `make status` @@ -76,12 +83,11 @@ Please be careful and check the code before run. ``` Specs 126 (102 successes, 4 failures, 20 pending) Examples 1190 (994 successes, 9 failures, 187 pending) -Compile (1073 successes, 82 failures) ``` #### `make gen_fixtures` generates -- [doc/spec/fixtures](./doc/spec/fixtures) # fixture data +- [doc/spec/fixtures](./doc/spec/fixtures) # fixture data (used for `comment-spec.cr`) ## TODO diff --git a/doc/compile/cache b/doc/compile/cache index f5f54e95..37b9c481 100644 --- a/doc/compile/cache +++ b/doc/compile/cache @@ -373,3 +373,10 @@ dd3eac8e892092abb91ee1fc47b013d64b9dca5c 1 yaml/001.cr bda6a9cad07a814c242786adcfd03ed89711ef94 1 yaml/003.cr 9657ce3ae69e4cd49a33f41998a95451a916b5d0 1 yaml/004.cr 181f0a4dd86a989dffe44a6e5136166973e68a83 1 yaml/005.cr +079308b625fdc3e137aef84b1655a66466aa6e96 1 array/all.cr +8452d8e793c5c617bb9a16d03f6195e94f6ea677 1 big/big_int/all.cr +d9c305ffe3da1019c9072da08530f0d266a07b30 1 bit_array/all.cr +e5845bc35701fe6f550bd867f7352bd32cc2a09f 0 enum/all.cr +4ed11918986766e352cd960551a6baf60f61fb13 1 pointer/all.cr +9292446c33be377d96f6b79231d9544eb61f58f2 0 enum/005.cr +0b76ae3999077b246f8d6ad250b6e2d11eee51e3 0 enum/006.cr diff --git a/doc/compile/log b/doc/compile/log index d6b70847..420e3ffa 100644 --- a/doc/compile/log +++ b/doc/compile/log @@ -1320,4 +1320,4 @@ OK: (1192/1195) compile: examples/yaml/mapping/002.cr OK: (1193/1195) compile: examples/yaml/mapping/003.cr OK: (1194/1195) compile: examples/zlib/deflate/001.cr OK: (1195/1195) compile: examples/zlib/inflate/001.cr -success: 1048(cached: 1048), failure: 116(cached: 116) +success: 1048(cached: 1048), failure: 116(cached: 114) diff --git a/doc/spec/cache b/doc/spec/cache index fe7054be..a4bcf9a6 100644 --- a/doc/spec/cache +++ b/doc/spec/cache @@ -1,8 +1,6 @@ -3a18d8977fedf47f1ce68ce57651ef554857b465 1 gen/spec/array_spec.cr e01ad0954b5aeec50940b61f6a69120c48e9855d 1 gen/spec/atomic_spec.cr f6d0bd538f302027fbd73d5981caf4b923df7d6d 1 gen/spec/base64_spec.cr 30d8ca512ab2d064cbdbc263823ca2ca582ab85e 1 gen/spec/benchmark_spec.cr -0cb27f032649886bab738dea147637d504c85965 1 gen/spec/big/big_int_spec.cr 422da44d7c77456c6ebcb522bdfb4628de5a4697 1 gen/spec/big/big_rational_spec.cr 3a5f67824476ce9eb53c51663a765adfeb5adbc6 1 gen/spec/bit_array_spec.cr 5b12e7b9583d744965df5c8db9376aef857b1562 1 gen/spec/bool_spec.cr @@ -23,7 +21,7 @@ be988536d9d9fa1d662d3ea260b1067afafc2e1e 1 gen/spec/csv_spec.cr 1691069b318dbde5e6bb9e4d57687978c3b46e93 1 gen/spec/deque_spec.cr 12a858f492962e9fb1d8bed3e4251e1fdab721b2 1 gen/spec/dir_spec.cr da39a3ee5e6b4b0d3255bfef95601890afd80709 1 gen/spec/ecr/macros_spec.cr -2063b7bcae69f2afcbf88e29a8141185c132a423 1 gen/spec/enum_spec.cr +82c053c72f3ddcee9c5ba51725ac834ee5e54c5b 1 gen/spec/enum_spec.cr d3c7190f4d452e800a713a1d19566ae2265cbe71 1 gen/spec/enumerable_spec.cr 30117e7500f659f8ed0a04a0a27c1d1f5975306d 1 gen/spec/env_spec.cr 062a784576bdbef5fda65b04cffd33834369ddfb 1 gen/spec/errno_spec.cr @@ -32,7 +30,6 @@ d3c7190f4d452e800a713a1d19566ae2265cbe71 1 gen/spec/enumerable_spec.cr aaf1490770bf8ee738892802a7a6a23c27f3ffbd 1 gen/spec/file_utils_spec.cr 3782f4b3c15b6fb16a3001823a4c6832b0de7fda 1 gen/spec/float_spec.cr d72c28c587606632c638379d9d026f7eec6a87ac 1 gen/spec/hash_spec.cr -df9d214fb1dae54ccdb8bd0f026eb895a46cf355 1 gen/spec/html_spec.cr 477519c118100fd81196233acd5c16fbb6645ea9 1 gen/spec/http/common_spec.cr 0eb4415f34cc4725a43cea378764bfeab86db455 1 gen/spec/http/cookie_spec.cr 60926bfd41b78d240c829a361c88fcd70500a378 1 gen/spec/http/headers_spec.cr @@ -68,12 +65,13 @@ b2cdc640b2df5bb9dc06fc1713848a99245b4f32 1 gen/spec/math/math_spec.cr 123f840416d8f6d52c1deb5e35d1587f914ad940 1 gen/spec/openssl/ssl/context_spec.cr cdfd57c744167a50bf2208a63c1e68cfb3b48b48 1 gen/spec/openssl/x509/name_spec.cr 0affb1e4ca1ee9e032c029ceea56e8810ca6e07f 1 gen/spec/option_parser_spec.cr -5dc904e00cc3887efceb659a3460fea8ca8b8a0c 1 gen/spec/pointer_spec.cr +fbffebf3370116ff0bcd272fc56af2122b3e1a81 1 gen/spec/pointer_spec.cr e82e19c877788801164388d46f4cc498f4cf7cab 1 gen/spec/pretty_print_spec.cr eaec79997aa534ade45eb4b9b7c2ac91a7d4095a 1 gen/spec/primitives_spec.cr 1d08878181bd94f5d69c95d09ba7b811418b8ab1 1 gen/spec/proc_spec.cr 731b1a4d3388d85bffad68098e456c2539a9b282 1 gen/spec/process_spec.cr 29e3dbc19c0af07aa46e2c4f64e46f138b3d5407 1 gen/spec/range/bsearch_spec.cr +5375fb7ae35a0b2c6cbc5092a8f0efaea44dd48a 1 gen/spec/range_spec.cr b9faf1bfaef1c5d9b55b6378dbd3c09de15a8a3b 1 gen/spec/reference_spec.cr eaab06dd2bcae1ce1ab34464207b38f73d9d372c 1 gen/spec/regex/match_data_spec.cr 15121858d21e974719385f7de7771a8411a4a156 1 gen/spec/regex_spec.cr @@ -82,9 +80,8 @@ eaab06dd2bcae1ce1ab34464207b38f73d9d372c 1 gen/spec/regex/match_data_spec.cr af338d62c4e45be0cb92b0b62bc7167ca804c70e 1 gen/spec/socket/address_spec.cr 070b955bd47c009ff998588656a871d043a36817 1 gen/spec/socket/addrinfo_spec.cr 114ac9ed66cf141d10497b10d6884d9e571ce0bd 1 gen/spec/spec_spec.cr -eeb2dcba29ecafbd2a96472d11a2f52d77747116 1 gen/spec/static_array_spec.cr e148eecdea45beb6390919591d6aee4fa831aa52 1 gen/spec/string_pool_spec.cr -634acd538c37751599d691f02c1bebc6c8b0c508 1 gen/spec/string_spec.cr +b8a36420be391da00fe372e7ec83abb5045bcd15 1 gen/spec/string_spec.cr c50bae5eb1702331edd826325dd7da35f69c1909 1 gen/spec/struct_spec.cr fc0ac35cc634782420407204ca6e4ddbcf9ebfaa 1 gen/spec/symbol_spec.cr c249934e102713ebb633ea5e57123fe584f3a84f 1 gen/spec/tempfile_spec.cr @@ -103,3 +100,7 @@ b30dcc9a70533859d944c2156dbf90419a0f2c6d 1 gen/spec/xml/node_spec.cr ce0d06d9f7d8ee60abc4f159f5e6e3896721b5ee 1 gen/spec/yaml_spec.cr 417e9631eee5a57d251885e7787304a87eb62a1c 1 gen/spec/zlib/deflate_spec.cr 3c6d3f49e590af45ba3b822a0d95eb8d8dbfe2e0 1 gen/spec/zlib/inflate_spec.cr +9b25e34a55ab8583f62ed064d2ecd4b6b2453dec 1 gen/spec/array_spec.cr +0cb27f032649886bab738dea147637d504c85965 1 gen/spec/big/big_int_spec.cr +0c7a056b2ff6028493b5657cb7c35a62719dee0c 1 gen/spec/static_array_spec.cr +d953c57327ed07d2172c933b4391f13888f9c471 1 gen/spec/html_spec.cr diff --git a/doc/spec/example_cnt_ng b/doc/spec/example_cnt_ng index b6a7d89c..573541ac 100644 --- a/doc/spec/example_cnt_ng +++ b/doc/spec/example_cnt_ng @@ -1 +1 @@ -16 +0 diff --git a/doc/spec/example_cnt_ok b/doc/spec/example_cnt_ok index 748632cf..d488f1cf 100644 --- a/doc/spec/example_cnt_ok +++ b/doc/spec/example_cnt_ok @@ -1 +1 @@ -996 +1011 diff --git a/doc/spec/example_cnt_ok_all b/doc/spec/example_cnt_ok_all index c7781419..d7f2bc9d 100644 --- a/doc/spec/example_cnt_ok_all +++ b/doc/spec/example_cnt_ok_all @@ -1 +1 @@ -1022 +1038 diff --git a/doc/spec/example_cnt_ok_pending b/doc/spec/example_cnt_ok_pending index 6f4247a6..f64f5d8d 100644 --- a/doc/spec/example_cnt_ok_pending +++ b/doc/spec/example_cnt_ok_pending @@ -1 +1 @@ -26 +27 diff --git a/doc/spec/example_cnt_pending b/doc/spec/example_cnt_pending index 90afb3e9..dc37bbdb 100644 --- a/doc/spec/example_cnt_pending +++ b/doc/spec/example_cnt_pending @@ -1 +1 @@ -183 +184 diff --git a/doc/spec/fixtures b/doc/spec/fixtures index d820a7e8..cadb1fb2 100644 --- a/doc/spec/fixtures +++ b/doc/spec/fixtures @@ -557,6 +557,10 @@ Array.new(3, 'a') # => ['a', 'a', 'a'] Benchmark.realtime { "a" * 100_000 } # => 00:00:00.0005840 BigInt.new # => 0 BigInt.new("1234567890ABCDEF", base: 16) # => 1311768467294899695 +BigInt.new("123456789101101987654321").to_s # => 123456789101101987654321 +BigInt.new("123456789101101987654321").to_s(16) # => 1a249b1f61599cd7eab1 +BigInt.new("123456789101101987654321").to_s(36) # => k3qmt029k48nmpd +BigInt.new("123456789101101987654321").to_s(8) # => 32111154373025463465765261 BigInt.new("123456789123456789123456789123456789") # => 123456789123456789123456789123456789 BigRational.new(2, 3) << 2 # => 8/3 BigRational.new(2, 3) >> 2 # => 1/6 @@ -569,6 +573,7 @@ Color.from_value?(1) # => Color::Green Color.from_value?(2) # => Color::Blue Color.from_value?(3) # => nil Color.names # => ["Red", "Green", "Blue"] +Color.new(1).to_s # => "Green" Color.new(10).to_i # => 10 Color.new(10).to_s # => "10" Color.parse("BLUE") # => Color::Blue @@ -1032,6 +1037,7 @@ array.update(1) { |x| x * 2 } # => 4 array2 = StaticArray(Int32, 3).new 0 # => StaticArray[0, 0, 0] array3 = StaticArray(Int32, 3).new 1 # => StaticArray[1, 1, 1] array[2] = 2 # => 2 +ary # => [[5, 2], [3, 4]] ary # => ["M", "i", "s", "s", "i", "s", "s", "i", "p", "p", "i"] ary # => ["M", "ss", "ss", "pp", ""] ary # => ["Mi", "i", "ippi"] @@ -1041,6 +1047,9 @@ ary # => ["a", "b", "c", "d"] ary # => ["a", "b", "c"] ary # => ["foo", "bar", "baz"] ary # => ["foo", "bar,baz"] +ary # => [[1], [1], [1]] +ary # => [[2], [1], [1]] +ary # => [[2], [2], [2]] ary # => [{false, [3, 1]}, {true, [4]}, {false, [1, 5, 9]}, {true, [2, 6]}, {false, [5, 3, 5]}] ary == [1, 2, 3] # => true ary == [2, 3] # => false @@ -1048,6 +1057,10 @@ ary.class # => StaticArray(Char | Int32, 2) ary.size # => 0 ary.to_unsafe[0] # => 1 ary.to_unsafe[0] # => 42 +ary2 # => [[1, 2], [3, 4], [7, 8]] +ary2 # => [[1, 2], [3, 4]] +ary2 # => [[5, 2], [3, 4], [7, 8]] +ary2 # => [[5, 2], [3, 4]] ary[-1] # => 'c' ary[-1]? # => 'c' ary[-2] # => 'b' @@ -1096,6 +1109,7 @@ ba # => "BitArray[101010101010]" ba # => BitArray[00110] ba # => BitArray[11001] ba = BitArray.new(12) # => "BitArray[000000000000]" +ba.to_s # => "BitArray[00000]" ba[2] # => false ba[2] # => true ba[3] # => false @@ -1498,22 +1512,6 @@ ptr[3] # => 3 ptr[3] # => 4 ptr[9] # => 0 puts "Hello #{destination}!" -puts BigInt.new("123456789101101987654321").to_s # => 123456789101101987654321 -puts BigInt.new("123456789101101987654321").to_s(16) # => 1a249b1f61599cd7eab1 -puts BigInt.new("123456789101101987654321").to_s(36) # => k3qmt029k48nmpd -puts BigInt.new("123456789101101987654321").to_s(8) # => 32111154373025463465765261 -puts Color.new(1) # => "Green" -puts Color.new(10) # => "10" -puts ary # => [[5, 2], [3, 4]] -puts ary # => [[1], [1], [1]] -puts ary # => [[2], [1], [1]] -puts ary # => [[2], [2], [2]] -puts ary2 # => [[1, 2], [3, 4], [7, 8]] -puts ary2 # => [[1, 2], [3, 4]] -puts ary2 # => [[5, 2], [3, 4], [7, 8]] -puts ary2 # => [[5, 2], [3, 4]] -puts ba.to_s # => "BitArray[00000]" -puts x # => 2 r.includes?(Xs.new(5)) # => true r.next_bool # => true r.next_int # => 2223112 @@ -1743,6 +1741,7 @@ wrapper.capitalize # => "Hello" wrapper.downcase # => "hello" wrapper.empty? # => false wrapper.gsub(/E/, "A") # => "HALLO" +x # => 2 x...y # an exclusive range, in mathematics: [x, y) x..y # an inclusive range, in mathematics: [x, y] yaml = YAML.dump({hello: "world"}) # => "---\nhello: world\n" diff --git a/doc/spec/log b/doc/spec/log index 3d7f7089..aa562593 100644 --- a/doc/spec/log +++ b/doc/spec/log @@ -75,19 +75,7 @@ OK: gen/spec/primitives_spec.cr (cached) OK: gen/spec/proc_spec.cr (cached) OK: gen/spec/process_spec.cr (cached) OK: gen/spec/range/bsearch_spec.cr (cached) -Using compiled compiler at .build/crystal -Error in line 1: while requiring "./gen/spec/range_spec.cr" - -in gen/spec/range_spec.cr:73: instantiating 'Range(Xs, Xs)#step(Int32)' - -range.step(2) { |x| puts x } - ^~~~ - -in crystal/src/range.cr:176: undefined local variable or method ' current' (did you mean 'current'?) - - yield current if !@exclusive &&  current == @end - ^~~~~~~~ - +OK: gen/spec/range_spec.cr (cached) OK: gen/spec/reference_spec.cr (cached) OK: gen/spec/regex/match_data_spec.cr (cached) OK: gen/spec/regex_spec.cr (cached) diff --git a/doc/spec/ng b/doc/spec/ng index 93705dd2..e69de29b 100644 --- a/doc/spec/ng +++ b/doc/spec/ng @@ -1 +0,0 @@ -gen/spec/range_spec.cr diff --git a/doc/spec/ok b/doc/spec/ok index 523248b4..8cf0d670 100644 --- a/doc/spec/ok +++ b/doc/spec/ok @@ -75,6 +75,7 @@ gen/spec/primitives_spec.cr gen/spec/proc_spec.cr gen/spec/process_spec.cr gen/spec/range/bsearch_spec.cr +gen/spec/range_spec.cr gen/spec/reference_spec.cr gen/spec/regex/match_data_spec.cr gen/spec/regex_spec.cr diff --git a/examples/array/007.cr b/examples/array/007.cr index ed864921..668dfa69 100644 --- a/examples/array/007.cr +++ b/examples/array/007.cr @@ -2,6 +2,6 @@ Array.new(3, 'a') # => ['a', 'a', 'a'] ary = Array.new(3, [1]) -puts ary # => [[1], [1], [1]] +ary # => [[1], [1], [1]] ary[0][0] = 2 -puts ary # => [[2], [2], [2]] +ary # => [[2], [2], [2]] diff --git a/examples/array/008.cr b/examples/array/008.cr index 47cc621e..51b46dd6 100644 --- a/examples/array/008.cr +++ b/examples/array/008.cr @@ -2,6 +2,6 @@ Array.new(3) { |i| (i + 1) ** 2 } # => [1, 4, 9] ary = Array.new(3) { [1] } -puts ary # => [[1], [1], [1]] +ary # => [[1], [1], [1]] ary[0][0] = 2 -puts ary # => [[2], [1], [1]] +ary # => [[2], [1], [1]] diff --git a/examples/array/026.cr b/examples/array/026.cr index 529fb4cb..6d242518 100644 --- a/examples/array/026.cr +++ b/examples/array/026.cr @@ -2,9 +2,9 @@ ary = [[1, 2], [3, 4]] ary2 = ary.clone ary[0][0] = 5 -puts ary # => [[5, 2], [3, 4]] -puts ary2 # => [[1, 2], [3, 4]] +ary # => [[5, 2], [3, 4]] +ary2 # => [[1, 2], [3, 4]] ary2 << [7, 8] -puts ary # => [[5, 2], [3, 4]] -puts ary2 # => [[1, 2], [3, 4], [7, 8]] +ary # => [[5, 2], [3, 4]] +ary2 # => [[1, 2], [3, 4], [7, 8]] diff --git a/examples/array/034.cr b/examples/array/034.cr index ad828eee..c48cb6f5 100644 --- a/examples/array/034.cr +++ b/examples/array/034.cr @@ -2,9 +2,9 @@ ary = [[1, 2], [3, 4]] ary2 = ary.dup ary[0][0] = 5 -puts ary # => [[5, 2], [3, 4]] -puts ary2 # => [[5, 2], [3, 4]] +ary # => [[5, 2], [3, 4]] +ary2 # => [[5, 2], [3, 4]] ary2 << [7, 8] -puts ary # => [[5, 2], [3, 4]] -puts ary2 # => [[5, 2], [3, 4], [7, 8]] +ary # => [[5, 2], [3, 4]] +ary2 # => [[5, 2], [3, 4], [7, 8]] diff --git a/examples/array/048.cr b/examples/array/048.cr index 4592a551..411b3812 100644 --- a/examples/array/048.cr +++ b/examples/array/048.cr @@ -1,5 +1,5 @@ # array.cr:960 a = [1, 2, 3] sums = [] of Int32 -a.each_permutation(2) { |p| sums << p.sum } # => [1, 2, 3] +a.each_permutation(2) { |p| sums << p.sum } # => nil sums # => [3, 4, 3, 5, 4, 5] diff --git a/examples/array/051.cr b/examples/array/051.cr index 0fe4b65c..62104b30 100644 --- a/examples/array/051.cr +++ b/examples/array/051.cr @@ -1,4 +1,4 @@ -# array.cr:1246 +# array.cr:1244 a = ["a", "b", "c"] a.pop # => "c" a # => ["a", "b"] diff --git a/examples/array/052.cr b/examples/array/052.cr index bad94a37..4d9dedf4 100644 --- a/examples/array/052.cr +++ b/examples/array/052.cr @@ -1,4 +1,4 @@ -# array.cr:1258 +# array.cr:1256 a = [1] a.pop { "Testing" } # => 1 a.pop { "Testing" } # => "Testing" diff --git a/examples/array/053.cr b/examples/array/053.cr index 245e86bd..d89258b4 100644 --- a/examples/array/053.cr +++ b/examples/array/053.cr @@ -1,4 +1,4 @@ -# array.cr:1280 +# array.cr:1278 a = ["a", "b", "c"] a.pop(2) # => ["b", "c"] a # => ["a"] diff --git a/examples/array/054.cr b/examples/array/054.cr index b3d0ea69..eb50ef9a 100644 --- a/examples/array/054.cr +++ b/examples/array/054.cr @@ -1,4 +1,4 @@ -# array.cr:1325 +# array.cr:1323 a = ["a", "b"] a.push("c") # => ["a", "b", "c"] # a.push(1) # Errors, because the array only accepts String. diff --git a/examples/array/055.cr b/examples/array/055.cr index f9f865c9..282a1ada 100644 --- a/examples/array/055.cr +++ b/examples/array/055.cr @@ -1,3 +1,3 @@ -# array.cr:1344 +# array.cr:1342 a = ["a"] a.push("b", "c") # => ["a", "b", "c"] diff --git a/examples/array/056.cr b/examples/array/056.cr index c24f591b..a5aab8f1 100644 --- a/examples/array/056.cr +++ b/examples/array/056.cr @@ -1,3 +1,3 @@ -# array.cr:1367 +# array.cr:1365 a = [1, 2, 3] a.reverse # => [3, 2, 1] diff --git a/examples/array/057.cr b/examples/array/057.cr index 655b1e40..0988d144 100644 --- a/examples/array/057.cr +++ b/examples/array/057.cr @@ -1,4 +1,4 @@ -# array.cr:1413 +# array.cr:1411 a = [1, 2, 3] a.sample(2) # => [2, 1] a.sample(2, Random.new(1)) # => [1, 3] diff --git a/examples/array/058.cr b/examples/array/058.cr index 5c6cb605..cf9effe3 100644 --- a/examples/array/058.cr +++ b/examples/array/058.cr @@ -1,4 +1,4 @@ -# array.cr:1451 +# array.cr:1449 a = ["a", "b", "c"] a.shift # => "a" a # => ["b", "c"] diff --git a/examples/array/059.cr b/examples/array/059.cr index 3d53c433..77b6bc65 100644 --- a/examples/array/059.cr +++ b/examples/array/059.cr @@ -1,4 +1,4 @@ -# array.cr:1478 +# array.cr:1476 a = ["a", "b", "c"] a.shift # => "a" a # => ["b", "c"] diff --git a/examples/array/060.cr b/examples/array/060.cr index bf11ea55..8fd8b938 100644 --- a/examples/array/060.cr +++ b/examples/array/060.cr @@ -1,4 +1,4 @@ -# array.cr:1521 +# array.cr:1519 a = [3, 1, 2] a.sort # => [1, 2, 3] a # => [3, 1, 2] diff --git a/examples/array/061.cr b/examples/array/061.cr index 9a4213c0..62ae0a2e 100644 --- a/examples/array/061.cr +++ b/examples/array/061.cr @@ -1,4 +1,4 @@ -# array.cr:1539 +# array.cr:1537 a = [3, 1, 2] a.sort! a # => [1, 2, 3] diff --git a/examples/array/062.cr b/examples/array/062.cr index 55d6f729..70ffa898 100644 --- a/examples/array/062.cr +++ b/examples/array/062.cr @@ -1,3 +1,3 @@ -# array.cr:1607 +# array.cr:1605 ary = [1, 2, 3] ary.to_unsafe[0] # => 1 diff --git a/examples/array/063.cr b/examples/array/063.cr index d719bbb2..1a1fbd75 100644 --- a/examples/array/063.cr +++ b/examples/array/063.cr @@ -1,4 +1,4 @@ -# array.cr:1617 +# array.cr:1615 a = [[:a, :b], [:c, :d], [:e, :f]] a.transpose # => [[:a, :c, :e], [:b, :d, :f]] a # => [[:a, :b], [:c, :d], [:e, :f]] diff --git a/examples/array/064.cr b/examples/array/064.cr index b8bdbdcb..f9f1cb25 100644 --- a/examples/array/064.cr +++ b/examples/array/064.cr @@ -1,4 +1,4 @@ -# array.cr:1640 +# array.cr:1638 a = ["a", "a", "b", "b", "c"] a.uniq # => ["a", "b", "c"] a # => [ "a", "a", "b", "b", "c" ] diff --git a/examples/array/065.cr b/examples/array/065.cr index 5733ce79..a0a15ca3 100644 --- a/examples/array/065.cr +++ b/examples/array/065.cr @@ -1,4 +1,4 @@ -# array.cr:1652 +# array.cr:1650 a = [{"student", "sam"}, {"student", "george"}, {"teacher", "matz"}] a.uniq { |s| s[0] } # => [{"student", "sam"}, {"teacher", "matz"}] a # => [{"student", "sam"}, {"student", "george"}, {"teacher", "matz"}] diff --git a/examples/array/066.cr b/examples/array/066.cr index c309c1a1..88d551ad 100644 --- a/examples/array/066.cr +++ b/examples/array/066.cr @@ -1,4 +1,4 @@ -# array.cr:1668 +# array.cr:1666 a = ["a", "a", "b", "b", "c"] a.uniq! # => ["a", "b", "c"] a # => ["a", "b", "c"] diff --git a/examples/array/067.cr b/examples/array/067.cr index df944f8c..2509a1f8 100644 --- a/examples/array/067.cr +++ b/examples/array/067.cr @@ -1,4 +1,4 @@ -# array.cr:1679 +# array.cr:1677 a = [{"student", "sam"}, {"student", "george"}, {"teacher", "matz"}] a.uniq! { |s| s[0] } # => [{"student", "sam"}, {"teacher", "matz"}] a # => [{"student", "sam"}, {"teacher", "matz"}] diff --git a/examples/array/068.cr b/examples/array/068.cr index a4b5ddab..a04e1a8a 100644 --- a/examples/array/068.cr +++ b/examples/array/068.cr @@ -1,4 +1,4 @@ -# array.cr:1715 +# array.cr:1713 a = ["a", "b"] a.unshift("c") # => ["c", "a", "b"] # a.unshift(1) # Errors, because the array only accepts String. diff --git a/examples/array/all.cr b/examples/array/all.cr index bbaed77b..2732f299 100644 --- a/examples/array/all.cr +++ b/examples/array/all.cr @@ -30,17 +30,17 @@ ary.size # => 0 Array.new(3, 'a') # => ['a', 'a', 'a'] ary = Array.new(3, [1]) -puts ary # => [[1], [1], [1]] +ary # => [[1], [1], [1]] ary[0][0] = 2 -puts ary # => [[2], [2], [2]] +ary # => [[2], [2], [2]] # array.cr:119 (008.cr) Array.new(3) { |i| (i + 1) ** 2 } # => [1, 4, 9] ary = Array.new(3) { [1] } -puts ary # => [[1], [1], [1]] +ary # => [[1], [1], [1]] ary[0][0] = 2 -puts ary # => [[2], [1], [1]] +ary # => [[2], [1], [1]] # array.cr:142 (009.cr) # pending by 'file:pendings/array/009.cr' @@ -153,12 +153,12 @@ a.clear # => [] ary = [[1, 2], [3, 4]] ary2 = ary.clone ary[0][0] = 5 -puts ary # => [[5, 2], [3, 4]] -puts ary2 # => [[1, 2], [3, 4]] +ary # => [[5, 2], [3, 4]] +ary2 # => [[1, 2], [3, 4]] ary2 << [7, 8] -puts ary # => [[5, 2], [3, 4]] -puts ary2 # => [[1, 2], [3, 4], [7, 8]] +ary # => [[5, 2], [3, 4]] +ary2 # => [[1, 2], [3, 4], [7, 8]] # array.cr:537 (027.cr) ["a", nil, "b", nil, "c", nil].compact # => ["a", "b", "c"] @@ -203,12 +203,12 @@ a # => ["ant", "dog"] ary = [[1, 2], [3, 4]] ary2 = ary.dup ary[0][0] = 5 -puts ary # => [[5, 2], [3, 4]] -puts ary2 # => [[5, 2], [3, 4]] +ary # => [[5, 2], [3, 4]] +ary2 # => [[5, 2], [3, 4]] ary2 << [7, 8] -puts ary # => [[5, 2], [3, 4]] -puts ary2 # => [[5, 2], [3, 4], [7, 8]] +ary # => [[5, 2], [3, 4]] +ary2 # => [[5, 2], [3, 4], [7, 8]] # array.cr:694 (035.cr) a = [1, 2, 3, 4] @@ -273,7 +273,7 @@ a.permutations(4) # => [] # array.cr:960 (048.cr) a = [1, 2, 3] sums = [] of Int32 -a.each_permutation(2) { |p| sums << p.sum } # => [1, 2, 3] +a.each_permutation(2) { |p| sums << p.sum } # => nil sums # => [3, 4, 3, 5, 4, 5] # array.cr:1009 (049.cr) @@ -293,17 +293,17 @@ u = [9, [10, 11].each] # => [9, #] a = [s, t, u, 12, 13] # => [[1, 2, 3], [4, 5, 6, [7, 8]], 9, #, 12, 13] a.flatten # => [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] -# array.cr:1246 (051.cr) +# array.cr:1244 (051.cr) a = ["a", "b", "c"] a.pop # => "c" a # => ["a", "b"] -# array.cr:1258 (052.cr) +# array.cr:1256 (052.cr) a = [1] a.pop { "Testing" } # => 1 a.pop { "Testing" } # => "Testing" -# array.cr:1280 (053.cr) +# array.cr:1278 (053.cr) a = ["a", "b", "c"] a.pop(2) # => ["b", "c"] a # => ["a"] @@ -312,7 +312,7 @@ a = ["a", "b", "c"] a.pop(4) # => ["a", "b", "c"] a # => [] -# array.cr:1325 (054.cr) +# array.cr:1323 (054.cr) a = ["a", "b"] a.push("c") # => ["a", "b", "c"] # a.push(1) # Errors, because the array only accepts String. @@ -321,25 +321,25 @@ a = ["a", "b"] of (Int32 | String) a.push("c") # => ["a", "b", "c"] a.push(1) # => ["a", "b", "c", 1] -# array.cr:1344 (055.cr) +# array.cr:1342 (055.cr) a = ["a"] a.push("b", "c") # => ["a", "b", "c"] -# array.cr:1367 (056.cr) +# array.cr:1365 (056.cr) a = [1, 2, 3] a.reverse # => [3, 2, 1] -# array.cr:1413 (057.cr) +# array.cr:1411 (057.cr) a = [1, 2, 3] a.sample(2) # => [2, 1] a.sample(2, Random.new(1)) # => [1, 3] -# array.cr:1451 (058.cr) +# array.cr:1449 (058.cr) a = ["a", "b", "c"] a.shift # => "a" a # => ["b", "c"] -# array.cr:1478 (059.cr) +# array.cr:1476 (059.cr) a = ["a", "b", "c"] a.shift # => "a" a # => ["b", "c"] @@ -348,46 +348,46 @@ a = ["a", "b", "c"] a.shift(4) # => ["a", "b", "c"] a # => [] -# array.cr:1521 (060.cr) +# array.cr:1519 (060.cr) a = [3, 1, 2] a.sort # => [1, 2, 3] a # => [3, 1, 2] -# array.cr:1539 (061.cr) +# array.cr:1537 (061.cr) a = [3, 1, 2] a.sort! a # => [1, 2, 3] -# array.cr:1607 (062.cr) +# array.cr:1605 (062.cr) ary = [1, 2, 3] ary.to_unsafe[0] # => 1 -# array.cr:1617 (063.cr) +# array.cr:1615 (063.cr) a = [[:a, :b], [:c, :d], [:e, :f]] a.transpose # => [[:a, :c, :e], [:b, :d, :f]] a # => [[:a, :b], [:c, :d], [:e, :f]] -# array.cr:1640 (064.cr) +# array.cr:1638 (064.cr) a = ["a", "a", "b", "b", "c"] a.uniq # => ["a", "b", "c"] a # => [ "a", "a", "b", "b", "c" ] -# array.cr:1652 (065.cr) +# array.cr:1650 (065.cr) a = [{"student", "sam"}, {"student", "george"}, {"teacher", "matz"}] a.uniq { |s| s[0] } # => [{"student", "sam"}, {"teacher", "matz"}] a # => [{"student", "sam"}, {"student", "george"}, {"teacher", "matz"}] -# array.cr:1668 (066.cr) +# array.cr:1666 (066.cr) a = ["a", "a", "b", "b", "c"] a.uniq! # => ["a", "b", "c"] a # => ["a", "b", "c"] -# array.cr:1679 (067.cr) +# array.cr:1677 (067.cr) a = [{"student", "sam"}, {"student", "george"}, {"teacher", "matz"}] a.uniq! { |s| s[0] } # => [{"student", "sam"}, {"teacher", "matz"}] a # => [{"student", "sam"}, {"teacher", "matz"}] -# array.cr:1715 (068.cr) +# array.cr:1713 (068.cr) a = ["a", "b"] a.unshift("c") # => ["c", "a", "b"] # a.unshift(1) # Errors, because the array only accepts String. diff --git a/examples/big/big_int/003.cr b/examples/big/big_int/003.cr index dadd9c96..cbf0f521 100644 --- a/examples/big/big_int/003.cr +++ b/examples/big/big_int/003.cr @@ -1,3 +1,3 @@ # big/big_int.cr:276 require "big" -puts BigInt.new("123456789101101987654321").to_s # => 123456789101101987654321 +BigInt.new("123456789101101987654321").to_s # => 123456789101101987654321 diff --git a/examples/big/big_int/004.cr b/examples/big/big_int/004.cr index 5acda5c0..7d39d7c6 100644 --- a/examples/big/big_int/004.cr +++ b/examples/big/big_int/004.cr @@ -1,5 +1,5 @@ # big/big_int.cr:291 require "big" -puts BigInt.new("123456789101101987654321").to_s(8) # => 32111154373025463465765261 -puts BigInt.new("123456789101101987654321").to_s(16) # => 1a249b1f61599cd7eab1 -puts BigInt.new("123456789101101987654321").to_s(36) # => k3qmt029k48nmpd +BigInt.new("123456789101101987654321").to_s(8) # => "32111154373025463465765261" +BigInt.new("123456789101101987654321").to_s(16) # => "1a249b1f61599cd7eab1" +BigInt.new("123456789101101987654321").to_s(36) # => "k3qmt029k48nmpd" diff --git a/examples/big/big_int/all.cr b/examples/big/big_int/all.cr index 7c0eedf0..41be2a7b 100644 --- a/examples/big/big_int/all.cr +++ b/examples/big/big_int/all.cr @@ -10,9 +10,9 @@ BigInt.new("123456789123456789123456789123456789") # => 123456789123456789123456 BigInt.new("1234567890ABCDEF", base: 16) # => 1311768467294899695 # big/big_int.cr:276 (003.cr) -puts BigInt.new("123456789101101987654321").to_s # => 123456789101101987654321 +BigInt.new("123456789101101987654321").to_s # => 123456789101101987654321 # big/big_int.cr:291 (004.cr) -puts BigInt.new("123456789101101987654321").to_s(8) # => 32111154373025463465765261 -puts BigInt.new("123456789101101987654321").to_s(16) # => 1a249b1f61599cd7eab1 -puts BigInt.new("123456789101101987654321").to_s(36) # => k3qmt029k48nmpd +BigInt.new("123456789101101987654321").to_s(8) # => "32111154373025463465765261" +BigInt.new("123456789101101987654321").to_s(16) # => "1a249b1f61599cd7eab1" +BigInt.new("123456789101101987654321").to_s(36) # => "k3qmt029k48nmpd" diff --git a/examples/bit_array/005.cr b/examples/bit_array/005.cr index 6207931a..d230cc14 100644 --- a/examples/bit_array/005.cr +++ b/examples/bit_array/005.cr @@ -1,4 +1,4 @@ # bit_array.cr:90 require "bit_array" ba = BitArray.new(5) -puts ba.to_s # => "BitArray[00000]" +ba.to_s # => "BitArray[00000]" diff --git a/examples/bit_array/all.cr b/examples/bit_array/all.cr index 865bad34..a8a833bf 100644 --- a/examples/bit_array/all.cr +++ b/examples/bit_array/all.cr @@ -29,4 +29,4 @@ ba # => BitArray[11001] # bit_array.cr:90 (005.cr) ba = BitArray.new(5) -puts ba.to_s # => "BitArray[00000]" +ba.to_s # => "BitArray[00000]" diff --git a/examples/enum/005.cr b/examples/enum/005.cr index d99965c2..2ed8f8a3 100644 --- a/examples/enum/005.cr +++ b/examples/enum/005.cr @@ -1,2 +1,2 @@ # enum.cr:46 -puts Color.new(1) # => "Green" +Color.new(1).to_s # => "Green" diff --git a/examples/enum/006.cr b/examples/enum/006.cr index 608fff5d..efc4280a 100644 --- a/examples/enum/006.cr +++ b/examples/enum/006.cr @@ -1,2 +1,2 @@ # enum.cr:53 -puts Color.new(10) # => "10" +Color.new(10).to_s # => "10" diff --git a/examples/enum/016.cr b/examples/enum/016.cr index 40b326dd..e9434fe0 100644 --- a/examples/enum/016.cr +++ b/examples/enum/016.cr @@ -1,2 +1,2 @@ -# enum.cr:241 +# enum.cr:246 (member & value) != 0 diff --git a/examples/enum/017.cr b/examples/enum/017.cr index df3eb8ae..1c73e12e 100644 --- a/examples/enum/017.cr +++ b/examples/enum/017.cr @@ -1,2 +1,2 @@ -# enum.cr:247 +# enum.cr:252 member.includes?(value) diff --git a/examples/enum/018.cr b/examples/enum/018.cr index 08580592..8b5a0f87 100644 --- a/examples/enum/018.cr +++ b/examples/enum/018.cr @@ -1,4 +1,4 @@ -# enum.cr:255 +# enum.cr:260 mode = IOMode::Read | IOMode::Write mode.includes?(IOMode::Read) # => true mode.includes?(IOMode::Async) # => false diff --git a/examples/enum/019.cr b/examples/enum/019.cr index eb42efca..a393f861 100644 --- a/examples/enum/019.cr +++ b/examples/enum/019.cr @@ -1,3 +1,3 @@ -# enum.cr:266 +# enum.cr:271 Color::Red == Color::Red # => true Color::Red == Color::Blue # => false diff --git a/examples/enum/020.cr b/examples/enum/020.cr index 19046866..1fe0bd92 100644 --- a/examples/enum/020.cr +++ b/examples/enum/020.cr @@ -1,4 +1,4 @@ -# enum.cr:281 +# enum.cr:286 (IOMode::Read | IOMode::Async).each do |member, value| # yield IOMode::Read, 1 # yield IOMode::Async, 3 diff --git a/examples/enum/021.cr b/examples/enum/021.cr index 204a7763..4a67281e 100644 --- a/examples/enum/021.cr +++ b/examples/enum/021.cr @@ -1,2 +1,2 @@ -# enum.cr:304 +# enum.cr:309 Color.names # => ["Red", "Green", "Blue"] diff --git a/examples/enum/022.cr b/examples/enum/022.cr index f02ac82e..f3539197 100644 --- a/examples/enum/022.cr +++ b/examples/enum/022.cr @@ -1,2 +1,2 @@ -# enum.cr:317 +# enum.cr:322 Color.values # => [Color::Red, Color::Green, Color::Blue] diff --git a/examples/enum/023.cr b/examples/enum/023.cr index c78bb939..dc5251ea 100644 --- a/examples/enum/023.cr +++ b/examples/enum/023.cr @@ -1,4 +1,4 @@ -# enum.cr:331 +# enum.cr:336 Color.from_value?(0) # => Color::Red Color.from_value?(1) # => Color::Green Color.from_value?(2) # => Color::Blue diff --git a/examples/enum/024.cr b/examples/enum/024.cr index 5fece4c6..809dec03 100644 --- a/examples/enum/024.cr +++ b/examples/enum/024.cr @@ -1,4 +1,4 @@ -# enum.cr:355 +# enum.cr:360 Color.from_value(0) # => Color::Red Color.from_value(1) # => Color::Green Color.from_value(2) # => Color::Blue diff --git a/examples/enum/025.cr b/examples/enum/025.cr index c1de35b1..5c2d0494 100644 --- a/examples/enum/025.cr +++ b/examples/enum/025.cr @@ -1,4 +1,4 @@ -# enum.cr:380 +# enum.cr:385 Color.parse("Red") # => Color::Red Color.parse("BLUE") # => Color::Blue # Color.parse("Yellow") # raises ArgumentError diff --git a/examples/enum/026.cr b/examples/enum/026.cr index 777ff095..b9789e0d 100644 --- a/examples/enum/026.cr +++ b/examples/enum/026.cr @@ -1,4 +1,4 @@ -# enum.cr:396 +# enum.cr:401 Color.parse?("Red") # => Color::Red Color.parse?("BLUE") # => Color::Blue Color.parse?("Yellow") # => nil diff --git a/examples/enum/027.cr b/examples/enum/027.cr index 2ba3494d..6fe2d016 100644 --- a/examples/enum/027.cr +++ b/examples/enum/027.cr @@ -1,2 +1,2 @@ -# enum.cr:420 +# enum.cr:425 IOMode.flags(Read, Write) # => IOMode::Read | IOMode::Write diff --git a/examples/enum/028.cr b/examples/enum/028.cr index 5a46a826..27f0683d 100644 --- a/examples/enum/028.cr +++ b/examples/enum/028.cr @@ -1,4 +1,4 @@ -# enum.cr:432 +# enum.cr:437 IOMode.each do |member, value| # yield IOMode::Read, 1 # yield IOMode::Write, 2 diff --git a/examples/enum/all.cr b/examples/enum/all.cr index a5992805..613edfb0 100644 --- a/examples/enum/all.cr +++ b/examples/enum/all.cr @@ -22,10 +22,10 @@ enum IOMode end # enum.cr:46 (005.cr) -puts Color.new(1) # => "Green" +Color.new(1).to_s # => "Green" # enum.cr:53 (006.cr) -puts Color.new(10) # => "10" +Color.new(10).to_s # => "10" # enum.cr:65 (007.cr) color = Color::Blue @@ -79,61 +79,61 @@ Color::Red <=> Color::Blue # => -1 Color::Blue <=> Color::Red # => 1 Color::Blue <=> Color::Blue # => 0 -# enum.cr:241 (016.cr) +# enum.cr:246 (016.cr) # pending by 'file:pendings/enum/016.cr' # (member & value) != 0 -# enum.cr:247 (017.cr) +# enum.cr:252 (017.cr) # pending by 'file:pendings/enum/017.cr' # member.includes?(value) -# enum.cr:255 (018.cr) +# enum.cr:260 (018.cr) mode = IOMode::Read | IOMode::Write mode.includes?(IOMode::Read) # => true mode.includes?(IOMode::Async) # => false -# enum.cr:266 (019.cr) +# enum.cr:271 (019.cr) Color::Red == Color::Red # => true Color::Red == Color::Blue # => false -# enum.cr:281 (020.cr) +# enum.cr:286 (020.cr) (IOMode::Read | IOMode::Async).each do |member, value| # yield IOMode::Read, 1 # yield IOMode::Async, 3 end -# enum.cr:304 (021.cr) +# enum.cr:309 (021.cr) Color.names # => ["Red", "Green", "Blue"] -# enum.cr:317 (022.cr) +# enum.cr:322 (022.cr) Color.values # => [Color::Red, Color::Green, Color::Blue] -# enum.cr:331 (023.cr) +# enum.cr:336 (023.cr) Color.from_value?(0) # => Color::Red Color.from_value?(1) # => Color::Green Color.from_value?(2) # => Color::Blue Color.from_value?(3) # => nil -# enum.cr:355 (024.cr) +# enum.cr:360 (024.cr) Color.from_value(0) # => Color::Red Color.from_value(1) # => Color::Green Color.from_value(2) # => Color::Blue Color.from_value(3) # raises Exception -# enum.cr:380 (025.cr) +# enum.cr:385 (025.cr) Color.parse("Red") # => Color::Red Color.parse("BLUE") # => Color::Blue # Color.parse("Yellow") # raises ArgumentError -# enum.cr:396 (026.cr) +# enum.cr:401 (026.cr) Color.parse?("Red") # => Color::Red Color.parse?("BLUE") # => Color::Blue Color.parse?("Yellow") # => nil -# enum.cr:420 (027.cr) +# enum.cr:425 (027.cr) IOMode.flags(Read, Write) # => IOMode::Read | IOMode::Write -# enum.cr:432 (028.cr) +# enum.cr:437 (028.cr) IOMode.each do |member, value| # yield IOMode::Read, 1 # yield IOMode::Write, 2 diff --git a/examples/hash/016.cr b/examples/hash/016.cr index 220f38ea..89789977 100644 --- a/examples/hash/016.cr +++ b/examples/hash/016.cr @@ -1,4 +1,4 @@ -# hash.cr:305 +# hash.cr:304 hsh = {"foo" => "bar", "baz" => "qux"} iterator = hsh.each diff --git a/examples/hash/017.cr b/examples/hash/017.cr index 6252ed79..1173ff32 100644 --- a/examples/hash/017.cr +++ b/examples/hash/017.cr @@ -1,4 +1,4 @@ -# hash.cr:318 +# hash.cr:317 h = {"foo" => "bar"} h.each_key do |key| key # => "foo" diff --git a/examples/hash/018.cr b/examples/hash/018.cr index 3340422c..74bf176e 100644 --- a/examples/hash/018.cr +++ b/examples/hash/018.cr @@ -1,4 +1,4 @@ -# hash.cr:333 +# hash.cr:332 hsh = {"foo" => "bar", "baz" => "qux"} iterator = hsh.each_key diff --git a/examples/hash/019.cr b/examples/hash/019.cr index c50dbb3d..35fe0578 100644 --- a/examples/hash/019.cr +++ b/examples/hash/019.cr @@ -1,4 +1,4 @@ -# hash.cr:349 +# hash.cr:348 h = {"foo" => "bar"} h.each_value do |value| value # => "bar" diff --git a/examples/hash/020.cr b/examples/hash/020.cr index 71343c6d..ed8fbb5f 100644 --- a/examples/hash/020.cr +++ b/examples/hash/020.cr @@ -1,4 +1,4 @@ -# hash.cr:364 +# hash.cr:363 hsh = {"foo" => "bar", "baz" => "qux"} iterator = hsh.each_value diff --git a/examples/hash/021.cr b/examples/hash/021.cr index db8b77dd..2b498f73 100644 --- a/examples/hash/021.cr +++ b/examples/hash/021.cr @@ -1,3 +1,3 @@ -# hash.cr:380 +# hash.cr:379 h = {"foo" => "bar", "baz" => "bar"} h.keys # => ["foo", "baz"] diff --git a/examples/hash/022.cr b/examples/hash/022.cr index 7785151a..53303d0b 100644 --- a/examples/hash/022.cr +++ b/examples/hash/022.cr @@ -1,3 +1,3 @@ -# hash.cr:392 +# hash.cr:391 h = {"foo" => "bar", "baz" => "qux"} h.values # => ["bar", "qux"] diff --git a/examples/hash/023.cr b/examples/hash/023.cr index f33e5e23..c92aae53 100644 --- a/examples/hash/023.cr +++ b/examples/hash/023.cr @@ -1,4 +1,4 @@ -# hash.cr:405 +# hash.cr:404 h = {"foo" => "bar", "baz" => "qux"} h.key_index("foo") # => 0 h.key_index("qux") # => nil diff --git a/examples/hash/024.cr b/examples/hash/024.cr index 28f0920f..237022e7 100644 --- a/examples/hash/024.cr +++ b/examples/hash/024.cr @@ -1,4 +1,4 @@ -# hash.cr:420 +# hash.cr:419 hash = {"foo" => "bar"} hash.merge({"baz" => "qux"}) # => {"foo" => "bar", "baz" => "qux"} diff --git a/examples/hash/025.cr b/examples/hash/025.cr index b134acb2..d53d2b1e 100644 --- a/examples/hash/025.cr +++ b/examples/hash/025.cr @@ -1,4 +1,4 @@ -# hash.cr:443 +# hash.cr:442 hash = {"foo" => "bar"} hash.merge!({"baz" => "qux"}) hash # => {"foo" => "bar", "baz" => "qux"} diff --git a/examples/hash/026.cr b/examples/hash/026.cr index e75d01a4..6adcefb1 100644 --- a/examples/hash/026.cr +++ b/examples/hash/026.cr @@ -1,4 +1,4 @@ -# hash.cr:467 +# hash.cr:466 h = {"a" => 100, "b" => 200, "c" => 300} h.select { |k, v| k > "a" } # => {"b" => 200, "c" => 300} h.select { |k, v| v < 200 } # => {"a" => 100} diff --git a/examples/hash/027.cr b/examples/hash/027.cr index 18e1ad3e..c459d281 100644 --- a/examples/hash/027.cr +++ b/examples/hash/027.cr @@ -1,4 +1,4 @@ -# hash.cr:482 +# hash.cr:481 h = {"a" => 100, "b" => 200, "c" => 300} h.reject { |k, v| k > "a" } # => {"a" => 100} h.reject { |k, v| v < 200 } # => {"b" => 200, "c" => 300} diff --git a/examples/hash/028.cr b/examples/hash/028.cr index 50c1e95e..aa3b0baf 100644 --- a/examples/hash/028.cr +++ b/examples/hash/028.cr @@ -1,2 +1,2 @@ -# hash.cr:504 +# hash.cr:503 {"a" => 1, "b" => 2, "c" => 3, "d" => 4}.reject("a", "c") # => {"b" => 2, "d" => 4} diff --git a/examples/hash/029.cr b/examples/hash/029.cr index 98927b0d..0ddc0381 100644 --- a/examples/hash/029.cr +++ b/examples/hash/029.cr @@ -1,3 +1,3 @@ -# hash.cr:514 +# hash.cr:513 h = {"a" => 1, "b" => 2, "c" => 3, "d" => 4}.reject!("a", "c") h # => {"b" => 2, "d" => 4} diff --git a/examples/hash/030.cr b/examples/hash/030.cr index da0a2cd0..14ed91bd 100644 --- a/examples/hash/030.cr +++ b/examples/hash/030.cr @@ -1,2 +1,2 @@ -# hash.cr:529 +# hash.cr:528 {"a" => 1, "b" => 2, "c" => 3, "d" => 4}.select("a", "c") # => {"a" => 1, "c" => 3} diff --git a/examples/hash/031.cr b/examples/hash/031.cr index cd38d878..071f43aa 100644 --- a/examples/hash/031.cr +++ b/examples/hash/031.cr @@ -1,3 +1,3 @@ -# hash.cr:544 +# hash.cr:543 h = {"a" => 1, "b" => 2, "c" => 3, "d" => 4}.select!("a", "c") h # => {"a" => 1, "c" => 3} diff --git a/examples/hash/032.cr b/examples/hash/032.cr index 2018fb06..7caf7b31 100644 --- a/examples/hash/032.cr +++ b/examples/hash/032.cr @@ -1,3 +1,3 @@ -# hash.cr:559 +# hash.cr:558 hash = {"hello" => "world", "foo" => nil} hash.compact # => {"hello" => "world"} diff --git a/examples/hash/033.cr b/examples/hash/033.cr index 5f88554a..56a0bf12 100644 --- a/examples/hash/033.cr +++ b/examples/hash/033.cr @@ -1,4 +1,4 @@ -# hash.cr:571 +# hash.cr:570 hash = {"hello" => "world", "foo" => nil} hash.compact! # => {"hello" => "world"} hash.compact! # => nil diff --git a/examples/hash/034.cr b/examples/hash/034.cr index 477011af..4f8148c6 100644 --- a/examples/hash/034.cr +++ b/examples/hash/034.cr @@ -1,3 +1,3 @@ -# hash.cr:582 +# hash.cr:581 Hash.zip(["key1", "key2", "key3"], ["value1", "value2", "value3"]) # => {"key1" => "value1", "key2" => "value2", "key3" => "value3"} diff --git a/examples/hash/035.cr b/examples/hash/035.cr index 6deff7c7..fd6c5c4e 100644 --- a/examples/hash/035.cr +++ b/examples/hash/035.cr @@ -1,4 +1,4 @@ -# hash.cr:601 +# hash.cr:600 hash = {"foo" => "bar"} hash.first_key? # => "foo" hash.clear diff --git a/examples/hash/036.cr b/examples/hash/036.cr index ee97eb67..a2d5b4dd 100644 --- a/examples/hash/036.cr +++ b/examples/hash/036.cr @@ -1,4 +1,4 @@ -# hash.cr:624 +# hash.cr:623 hash = {"foo" => "bar", "baz" => "qux"} hash.shift # => {"foo", "bar"} hash # => {"baz" => "qux"} diff --git a/examples/hash/037.cr b/examples/hash/037.cr index 306c9bc4..14bcc940 100644 --- a/examples/hash/037.cr +++ b/examples/hash/037.cr @@ -1,4 +1,4 @@ -# hash.cr:638 +# hash.cr:637 hash = {"foo" => "bar", "baz" => "qux"} hash.shift? # => {"foo", "bar"} hash # => {"baz" => "qux"} diff --git a/examples/hash/038.cr b/examples/hash/038.cr index 04fdef17..d3bbdc0a 100644 --- a/examples/hash/038.cr +++ b/examples/hash/038.cr @@ -1,4 +1,4 @@ -# hash.cr:653 +# hash.cr:652 hash = {"foo" => "bar", "baz" => "qux"} hash.shift { true } # => {"foo", "bar"} hash # => {"baz" => "qux"} diff --git a/examples/hash/039.cr b/examples/hash/039.cr index e4662bba..d669e126 100644 --- a/examples/hash/039.cr +++ b/examples/hash/039.cr @@ -1,3 +1,3 @@ -# hash.cr:674 +# hash.cr:673 hash = {"foo" => "bar"} hash.clear # => {} diff --git a/examples/hash/040.cr b/examples/hash/040.cr index 27dc71ad..fa9ebaad 100644 --- a/examples/hash/040.cr +++ b/examples/hash/040.cr @@ -1,3 +1,3 @@ -# hash.cr:700 +# hash.cr:699 foo = {"foo" => "bar"} foo.hash # => 3247054 diff --git a/examples/hash/041.cr b/examples/hash/041.cr index 36a26708..a2d4823b 100644 --- a/examples/hash/041.cr +++ b/examples/hash/041.cr @@ -1,4 +1,4 @@ -# hash.cr:714 +# hash.cr:713 hash_a = {"foo" => "bar"} hash_b = hash_a.dup hash_b.merge!({"baz" => "qux"}) diff --git a/examples/hash/042.cr b/examples/hash/042.cr index 7683722f..d811ef59 100644 --- a/examples/hash/042.cr +++ b/examples/hash/042.cr @@ -1,4 +1,4 @@ -# hash.cr:730 +# hash.cr:729 hash_a = {"foobar" => {"foo" => "bar"}} hash_b = hash_a.clone hash_b["foobar"]["foo"] = "baz" diff --git a/examples/hash/043.cr b/examples/hash/043.cr index 2baa2c22..0dd5b976 100644 --- a/examples/hash/043.cr +++ b/examples/hash/043.cr @@ -1,4 +1,4 @@ -# hash.cr:750 +# hash.cr:749 h = {"foo" => "bar"} h.to_s # => "{\"foo\" => \"bar\"}" h.to_s.class # => String diff --git a/examples/hash/044.cr b/examples/hash/044.cr index 51b2ea88..1f40a127 100644 --- a/examples/hash/044.cr +++ b/examples/hash/044.cr @@ -1,3 +1,3 @@ -# hash.cr:808 +# hash.cr:807 {"foo" => "bar"}.invert # => {"bar" => "foo"} {"foo" => "bar", "baz" => "bar"}.invert # => {"bar" => "baz"} diff --git a/examples/hash/all.cr b/examples/hash/all.cr index e8b67bc3..b2bc6f69 100644 --- a/examples/hash/all.cr +++ b/examples/hash/all.cr @@ -95,20 +95,20 @@ h.each do |key_and_value| key_and_value # => {"foo", "bar"} end -# hash.cr:305 (016.cr) +# hash.cr:304 (016.cr) hsh = {"foo" => "bar", "baz" => "qux"} iterator = hsh.each iterator.next # => {"foo", "bar"} iterator.next # => {"baz", "qux"} -# hash.cr:318 (017.cr) +# hash.cr:317 (017.cr) h = {"foo" => "bar"} h.each_key do |key| key # => "foo" end -# hash.cr:333 (018.cr) +# hash.cr:332 (018.cr) hsh = {"foo" => "bar", "baz" => "qux"} iterator = hsh.each_key @@ -118,13 +118,13 @@ key # => "foo" key = iterator.next key # => "baz" -# hash.cr:349 (019.cr) +# hash.cr:348 (019.cr) h = {"foo" => "bar"} h.each_value do |value| value # => "bar" end -# hash.cr:364 (020.cr) +# hash.cr:363 (020.cr) hsh = {"foo" => "bar", "baz" => "qux"} iterator = hsh.each_value @@ -134,75 +134,75 @@ value # => "bar" value = iterator.next value # => "qux" -# hash.cr:380 (021.cr) +# hash.cr:379 (021.cr) h = {"foo" => "bar", "baz" => "bar"} h.keys # => ["foo", "baz"] -# hash.cr:392 (022.cr) +# hash.cr:391 (022.cr) h = {"foo" => "bar", "baz" => "qux"} h.values # => ["bar", "qux"] -# hash.cr:405 (023.cr) +# hash.cr:404 (023.cr) h = {"foo" => "bar", "baz" => "qux"} h.key_index("foo") # => 0 h.key_index("qux") # => nil -# hash.cr:420 (024.cr) +# hash.cr:419 (024.cr) hash = {"foo" => "bar"} hash.merge({"baz" => "qux"}) # => {"foo" => "bar", "baz" => "qux"} hash # => {"foo" => "bar"} -# hash.cr:443 (025.cr) +# hash.cr:442 (025.cr) hash = {"foo" => "bar"} hash.merge!({"baz" => "qux"}) hash # => {"foo" => "bar", "baz" => "qux"} -# hash.cr:467 (026.cr) +# hash.cr:466 (026.cr) h = {"a" => 100, "b" => 200, "c" => 300} h.select { |k, v| k > "a" } # => {"b" => 200, "c" => 300} h.select { |k, v| v < 200 } # => {"a" => 100} -# hash.cr:482 (027.cr) +# hash.cr:481 (027.cr) h = {"a" => 100, "b" => 200, "c" => 300} h.reject { |k, v| k > "a" } # => {"a" => 100} h.reject { |k, v| v < 200 } # => {"b" => 200, "c" => 300} -# hash.cr:504 (028.cr) +# hash.cr:503 (028.cr) {"a" => 1, "b" => 2, "c" => 3, "d" => 4}.reject("a", "c") # => {"b" => 2, "d" => 4} -# hash.cr:514 (029.cr) +# hash.cr:513 (029.cr) h = {"a" => 1, "b" => 2, "c" => 3, "d" => 4}.reject!("a", "c") h # => {"b" => 2, "d" => 4} -# hash.cr:529 (030.cr) +# hash.cr:528 (030.cr) {"a" => 1, "b" => 2, "c" => 3, "d" => 4}.select("a", "c") # => {"a" => 1, "c" => 3} -# hash.cr:544 (031.cr) +# hash.cr:543 (031.cr) h = {"a" => 1, "b" => 2, "c" => 3, "d" => 4}.select!("a", "c") h # => {"a" => 1, "c" => 3} -# hash.cr:559 (032.cr) +# hash.cr:558 (032.cr) hash = {"hello" => "world", "foo" => nil} hash.compact # => {"hello" => "world"} -# hash.cr:571 (033.cr) +# hash.cr:570 (033.cr) hash = {"hello" => "world", "foo" => nil} hash.compact! # => {"hello" => "world"} hash.compact! # => nil -# hash.cr:582 (034.cr) +# hash.cr:581 (034.cr) Hash.zip(["key1", "key2", "key3"], ["value1", "value2", "value3"]) # => {"key1" => "value1", "key2" => "value2", "key3" => "value3"} -# hash.cr:601 (035.cr) +# hash.cr:600 (035.cr) hash = {"foo" => "bar"} hash.first_key? # => "foo" hash.clear hash.first_key? # => nil -# hash.cr:624 (036.cr) +# hash.cr:623 (036.cr) hash = {"foo" => "bar", "baz" => "qux"} hash.shift # => {"foo", "bar"} hash # => {"baz" => "qux"} @@ -210,7 +210,7 @@ hash # => {"baz" => "qux"} hash = {} of String => String # hash.shift # raises IndexError -# hash.cr:638 (037.cr) +# hash.cr:637 (037.cr) hash = {"foo" => "bar", "baz" => "qux"} hash.shift? # => {"foo", "bar"} hash # => {"baz" => "qux"} @@ -218,7 +218,7 @@ hash # => {"baz" => "qux"} hash = {} of String => String hash.shift? # => nil -# hash.cr:653 (038.cr) +# hash.cr:652 (038.cr) hash = {"foo" => "bar", "baz" => "qux"} hash.shift { true } # => {"foo", "bar"} hash # => {"baz" => "qux"} @@ -227,31 +227,31 @@ hash = {} of String => String hash.shift { true } # => true hash # => {} -# hash.cr:674 (039.cr) +# hash.cr:673 (039.cr) hash = {"foo" => "bar"} hash.clear # => {} -# hash.cr:700 (040.cr) +# hash.cr:699 (040.cr) foo = {"foo" => "bar"} foo.hash # => 3247054 -# hash.cr:714 (041.cr) +# hash.cr:713 (041.cr) hash_a = {"foo" => "bar"} hash_b = hash_a.dup hash_b.merge!({"baz" => "qux"}) hash_a # => {"foo" => "bar"} -# hash.cr:730 (042.cr) +# hash.cr:729 (042.cr) hash_a = {"foobar" => {"foo" => "bar"}} hash_b = hash_a.clone hash_b["foobar"]["foo"] = "baz" hash_a # => {"foobar" => {"foo" => "bar"}} -# hash.cr:750 (043.cr) +# hash.cr:749 (043.cr) h = {"foo" => "bar"} h.to_s # => "{\"foo\" => \"bar\"}" h.to_s.class # => String -# hash.cr:808 (044.cr) +# hash.cr:807 (044.cr) {"foo" => "bar"}.invert # => {"bar" => "foo"} {"foo" => "bar", "baz" => "bar"}.invert # => {"bar" => "baz"} diff --git a/examples/html/002.cr b/examples/html/002.cr index 3b3fe4f4..6c25fc69 100644 --- a/examples/html/002.cr +++ b/examples/html/002.cr @@ -2,5 +2,5 @@ require "html" io = IO::Memory.new -HTML.escape("Crystal & You", io) # => "Crystal & You" +HTML.escape("Crystal & You", io) # => nil io.to_s # => "Crystal & You" diff --git a/examples/html/all.cr b/examples/html/all.cr index daa6b084..e8368043 100644 --- a/examples/html/all.cr +++ b/examples/html/all.cr @@ -10,7 +10,7 @@ HTML.escape("Crystal & You") # => "Crystal & You" require "html" io = IO::Memory.new -HTML.escape("Crystal & You", io) # => "Crystal & You" +HTML.escape("Crystal & You", io) # => nil io.to_s # => "Crystal & You" # html.cr:53 (003.cr) diff --git a/examples/http/headers/001.cr b/examples/http/headers/001.cr index 04c9ce93..0034216a 100644 --- a/examples/http/headers/001.cr +++ b/examples/http/headers/001.cr @@ -1,4 +1,4 @@ -# http/headers.cr:77 +# http/headers.cr:79 require "http/headers" headers = HTTP::Headers{"Connection" => "keep-alive, Upgrade"} headers.includes_word?("Connection", "Upgrade") # => true diff --git a/examples/http/headers/all.cr b/examples/http/headers/all.cr index 6100ec09..a66578c9 100644 --- a/examples/http/headers/all.cr +++ b/examples/http/headers/all.cr @@ -1,6 +1,6 @@ # http/headers.cr: 1 examples require "http/headers" -# http/headers.cr:77 (001.cr) +# http/headers.cr:79 (001.cr) headers = HTTP::Headers{"Connection" => "keep-alive, Upgrade"} headers.includes_word?("Connection", "Upgrade") # => true diff --git a/examples/indexable/010.cr b/examples/indexable/010.cr index 07d9017e..c59bb9a4 100644 --- a/examples/indexable/010.cr +++ b/examples/indexable/010.cr @@ -1,4 +1,4 @@ -# indexable.cr:192 +# indexable.cr:191 a = ["a", "b", "c"] iter = a.each_index iter.next # => 0 diff --git a/examples/indexable/011.cr b/examples/indexable/011.cr index 4522c129..d34c713f 100644 --- a/examples/indexable/011.cr +++ b/examples/indexable/011.cr @@ -1,3 +1,3 @@ -# indexable.cr:207 +# indexable.cr:206 ([] of Int32).empty? # => true ([1]).empty? # => false diff --git a/examples/indexable/012.cr b/examples/indexable/012.cr index 9cc9255b..ee9f6ce6 100644 --- a/examples/indexable/012.cr +++ b/examples/indexable/012.cr @@ -1,4 +1,4 @@ -# indexable.cr:222 +# indexable.cr:221 a = [1, 2, 3] b = ["a", "ab", "abc"] a.equals?(b) { |x, y| x == y.size } # => true diff --git a/examples/indexable/013.cr b/examples/indexable/013.cr index 3496d719..89865d0c 100644 --- a/examples/indexable/013.cr +++ b/examples/indexable/013.cr @@ -1,3 +1,3 @@ -# indexable.cr:238 +# indexable.cr:237 ([1, 2, 3]).first # => 1 # ([] of Int32).first # raises IndexError diff --git a/examples/indexable/014.cr b/examples/indexable/014.cr index 3c9d1e10..761161ea 100644 --- a/examples/indexable/014.cr +++ b/examples/indexable/014.cr @@ -1,3 +1,3 @@ -# indexable.cr:248 +# indexable.cr:247 ([1, 2, 3]).first { 4 } # => 1 ([] of Int32).first { 4 } # => 4 diff --git a/examples/indexable/015.cr b/examples/indexable/015.cr index 9e6dc40e..819673b2 100644 --- a/examples/indexable/015.cr +++ b/examples/indexable/015.cr @@ -1,3 +1,3 @@ -# indexable.cr:258 +# indexable.cr:257 ([1, 2, 3]).first? # => 1 ([] of Int32).first? # => nil diff --git a/examples/indexable/016.cr b/examples/indexable/016.cr index 6c8c9bd8..d892ade9 100644 --- a/examples/indexable/016.cr +++ b/examples/indexable/016.cr @@ -1,2 +1,2 @@ -# indexable.cr:278 +# indexable.cr:277 [1, 2, 3, 1, 2, 3].index(2, offset: 2) # => 4 diff --git a/examples/indexable/017.cr b/examples/indexable/017.cr index 1369a0ac..2e286456 100644 --- a/examples/indexable/017.cr +++ b/examples/indexable/017.cr @@ -1,2 +1,2 @@ -# indexable.cr:289 +# indexable.cr:288 [1, 2, 3, 1, 2, 3].index(offset: 2) { |x| x < 2 } # => 3 diff --git a/examples/indexable/018.cr b/examples/indexable/018.cr index dbdf1676..d4cbc09c 100644 --- a/examples/indexable/018.cr +++ b/examples/indexable/018.cr @@ -1,3 +1,3 @@ -# indexable.cr:306 +# indexable.cr:305 ([1, 2, 3]).last # => 3 # ([] of Int32).last # raises IndexError diff --git a/examples/indexable/019.cr b/examples/indexable/019.cr index 29d18e40..e5f4b15e 100644 --- a/examples/indexable/019.cr +++ b/examples/indexable/019.cr @@ -1,3 +1,3 @@ -# indexable.cr:316 +# indexable.cr:315 ([1, 2, 3]).last { 4 } # => 3 ([] of Int32).last { 4 } # => 4 diff --git a/examples/indexable/020.cr b/examples/indexable/020.cr index 70608d3a..cfa894a5 100644 --- a/examples/indexable/020.cr +++ b/examples/indexable/020.cr @@ -1,3 +1,3 @@ -# indexable.cr:326 +# indexable.cr:325 ([1, 2, 3]).last? # => 3 ([] of Int32).last? # => nil diff --git a/examples/indexable/021.cr b/examples/indexable/021.cr index 53893161..e9d33ce9 100644 --- a/examples/indexable/021.cr +++ b/examples/indexable/021.cr @@ -1,3 +1,3 @@ -# indexable.cr:353 +# indexable.cr:351 [1, 2, 3, 2, 3].rindex(2) # => 3 [1, 2, 3, 2, 3].rindex(2, offset: 2) # => 1 diff --git a/examples/indexable/022.cr b/examples/indexable/022.cr index a6319392..967165be 100644 --- a/examples/indexable/022.cr +++ b/examples/indexable/022.cr @@ -1,3 +1,3 @@ -# indexable.cr:368 +# indexable.cr:366 [1, 2, 3, 2, 3].rindex { |x| x < 3 } # => 3 [1, 2, 3, 2, 3].rindex(offset: 2) { |x| x < 3 } # => 1 diff --git a/examples/indexable/023.cr b/examples/indexable/023.cr index f78c00fa..98350ce0 100644 --- a/examples/indexable/023.cr +++ b/examples/indexable/023.cr @@ -1,4 +1,4 @@ -# indexable.cr:387 +# indexable.cr:385 a = [1, 2, 3] a.sample # => 2 a.sample # => 1 diff --git a/examples/indexable/024.cr b/examples/indexable/024.cr index 5c0c8499..01b24148 100644 --- a/examples/indexable/024.cr +++ b/examples/indexable/024.cr @@ -1,2 +1,2 @@ -# indexable.cr:401 +# indexable.cr:399 ["a", "b", "c", "d"].values_at(0, 2) # => {"a", "c"} diff --git a/examples/indexable/all.cr b/examples/indexable/all.cr index 0cb1f21d..f180f402 100644 --- a/examples/indexable/all.cr +++ b/examples/indexable/all.cr @@ -52,65 +52,65 @@ iter.next # => "b" a = ["a", "b", "c"] a.each_index { |x| print x, " -- " } -# indexable.cr:192 (010.cr) +# indexable.cr:191 (010.cr) a = ["a", "b", "c"] iter = a.each_index iter.next # => 0 iter.next # => 1 -# indexable.cr:207 (011.cr) +# indexable.cr:206 (011.cr) ([] of Int32).empty? # => true ([1]).empty? # => false -# indexable.cr:222 (012.cr) +# indexable.cr:221 (012.cr) a = [1, 2, 3] b = ["a", "ab", "abc"] a.equals?(b) { |x, y| x == y.size } # => true a.equals?(b) { |x, y| x == y } # => false -# indexable.cr:238 (013.cr) +# indexable.cr:237 (013.cr) ([1, 2, 3]).first # => 1 # ([] of Int32).first # raises IndexError -# indexable.cr:248 (014.cr) +# indexable.cr:247 (014.cr) ([1, 2, 3]).first { 4 } # => 1 ([] of Int32).first { 4 } # => 4 -# indexable.cr:258 (015.cr) +# indexable.cr:257 (015.cr) ([1, 2, 3]).first? # => 1 ([] of Int32).first? # => nil -# indexable.cr:278 (016.cr) +# indexable.cr:277 (016.cr) [1, 2, 3, 1, 2, 3].index(2, offset: 2) # => 4 -# indexable.cr:289 (017.cr) +# indexable.cr:288 (017.cr) [1, 2, 3, 1, 2, 3].index(offset: 2) { |x| x < 2 } # => 3 -# indexable.cr:306 (018.cr) +# indexable.cr:305 (018.cr) ([1, 2, 3]).last # => 3 # ([] of Int32).last # raises IndexError -# indexable.cr:316 (019.cr) +# indexable.cr:315 (019.cr) ([1, 2, 3]).last { 4 } # => 3 ([] of Int32).last { 4 } # => 4 -# indexable.cr:326 (020.cr) +# indexable.cr:325 (020.cr) ([1, 2, 3]).last? # => 3 ([] of Int32).last? # => nil -# indexable.cr:353 (021.cr) +# indexable.cr:351 (021.cr) [1, 2, 3, 2, 3].rindex(2) # => 3 [1, 2, 3, 2, 3].rindex(2, offset: 2) # => 1 -# indexable.cr:368 (022.cr) +# indexable.cr:366 (022.cr) [1, 2, 3, 2, 3].rindex { |x| x < 3 } # => 3 [1, 2, 3, 2, 3].rindex(offset: 2) { |x| x < 3 } # => 1 -# indexable.cr:387 (023.cr) +# indexable.cr:385 (023.cr) a = [1, 2, 3] a.sample # => 2 a.sample # => 1 a.sample(Random.new(1)) # => 3 -# indexable.cr:401 (024.cr) +# indexable.cr:399 (024.cr) ["a", "b", "c", "d"].values_at(0, 2) # => {"a", "c"} diff --git a/examples/int/012.cr b/examples/int/012.cr index 52ee3602..2e888076 100644 --- a/examples/int/012.cr +++ b/examples/int/012.cr @@ -1,3 +1,3 @@ -# int.cr:476 +# int.cr:472 5.popcount # => 2 -15.popcount # => 29 diff --git a/examples/int/all.cr b/examples/int/all.cr index ff54819f..404ae408 100644 --- a/examples/int/all.cr +++ b/examples/int/all.cr @@ -66,6 +66,6 @@ 11.bit(3) # => 1 11.bit(4) # => 0 -# int.cr:476 (012.cr) +# int.cr:472 (012.cr) 5.popcount # => 2 -15.popcount # => 29 diff --git a/examples/kernel/002.cr b/examples/kernel/002.cr index cc1fa1a8..20f3d0cb 100644 --- a/examples/kernel/002.cr +++ b/examples/kernel/002.cr @@ -1,2 +1,2 @@ -# kernel.cr:110 +# kernel.cr:109 p foo: 23, bar: 42 # => {foo: 23, bar: 42} diff --git a/examples/kernel/003.cr b/examples/kernel/003.cr index add65211..07adb991 100644 --- a/examples/kernel/003.cr +++ b/examples/kernel/003.cr @@ -1,4 +1,4 @@ -# kernel.cr:145 +# kernel.cr:144 def do_at_exit(str1) at_exit { print str1 } end diff --git a/examples/kernel/all.cr b/examples/kernel/all.cr index 5f48b458..224bea50 100644 --- a/examples/kernel/all.cr +++ b/examples/kernel/all.cr @@ -8,10 +8,10 @@ loop do |i| # ... end -# kernel.cr:110 (002.cr) +# kernel.cr:109 (002.cr) p foo: 23, bar: 42 # => {foo: 23, bar: 42} -# kernel.cr:145 (003.cr) +# kernel.cr:144 (003.cr) def do_at_exit(str1) at_exit { print str1 } end diff --git a/examples/named_tuple/015.cr b/examples/named_tuple/015.cr index 0ba8b3ec..7a985a4f 100644 --- a/examples/named_tuple/015.cr +++ b/examples/named_tuple/015.cr @@ -1,4 +1,4 @@ -# named_tuple.cr:302 +# named_tuple.cr:301 tuple = {name: "Crystal", year: 2011} tuple.each_key do |key| puts key diff --git a/examples/named_tuple/016.cr b/examples/named_tuple/016.cr index 63ff66e4..f5fede38 100644 --- a/examples/named_tuple/016.cr +++ b/examples/named_tuple/016.cr @@ -1,4 +1,4 @@ -# named_tuple.cr:324 +# named_tuple.cr:322 tuple = {name: "Crystal", year: 2011} tuple.each_value do |value| puts value diff --git a/examples/named_tuple/017.cr b/examples/named_tuple/017.cr index 9f796f26..5d52159a 100644 --- a/examples/named_tuple/017.cr +++ b/examples/named_tuple/017.cr @@ -1,4 +1,4 @@ -# named_tuple.cr:346 +# named_tuple.cr:343 tuple = {name: "Crystal", year: 2011} tuple.each_with_index do |key, value, i| puts "#{i + 1}) #{key} = #{value}" diff --git a/examples/named_tuple/018.cr b/examples/named_tuple/018.cr index 396cb8c8..97f02677 100644 --- a/examples/named_tuple/018.cr +++ b/examples/named_tuple/018.cr @@ -1,3 +1,3 @@ -# named_tuple.cr:371 +# named_tuple.cr:367 tuple = {name: "Crystal", year: 2011} tuple.map { |k, v| "#{k}: #{v}" } # => ["name: Crystal", "year: 2011"] diff --git a/examples/named_tuple/019.cr b/examples/named_tuple/019.cr index 36a3b035..15a3e919 100644 --- a/examples/named_tuple/019.cr +++ b/examples/named_tuple/019.cr @@ -1,3 +1,3 @@ -# named_tuple.cr:385 +# named_tuple.cr:381 tuple = {name: "Crystal", year: 2011} tuple.to_a # => [{:name, "Crystal"}, {:year, 2011}] diff --git a/examples/named_tuple/020.cr b/examples/named_tuple/020.cr index 697d8a4f..073279ba 100644 --- a/examples/named_tuple/020.cr +++ b/examples/named_tuple/020.cr @@ -1,3 +1,3 @@ -# named_tuple.cr:399 +# named_tuple.cr:395 tuple = {name: "Crystal", year: 2011} tuple.to_h # => {:name => "Crystal", :year => 2011} diff --git a/examples/named_tuple/021.cr b/examples/named_tuple/021.cr index a4bb864e..5fb0afb7 100644 --- a/examples/named_tuple/021.cr +++ b/examples/named_tuple/021.cr @@ -1,3 +1,3 @@ -# named_tuple.cr:415 +# named_tuple.cr:411 tuple = {name: "Crystal", year: 2011} tuple.size # => 2 diff --git a/examples/named_tuple/022.cr b/examples/named_tuple/022.cr index ea88dbca..8f204381 100644 --- a/examples/named_tuple/022.cr +++ b/examples/named_tuple/022.cr @@ -1,3 +1,3 @@ -# named_tuple.cr:425 +# named_tuple.cr:421 tuple = {name: "Crystal", year: 2011} tuple.empty? # => false diff --git a/examples/named_tuple/023.cr b/examples/named_tuple/023.cr index d4dbdb2f..13722b17 100644 --- a/examples/named_tuple/023.cr +++ b/examples/named_tuple/023.cr @@ -1,4 +1,4 @@ -# named_tuple.cr:436 +# named_tuple.cr:432 tuple1 = {name: "Crystal", year: 2011} tuple2 = {year: 2011, name: "Crystal"} tuple3 = {name: "Crystal", year: 2012} diff --git a/examples/named_tuple/all.cr b/examples/named_tuple/all.cr index ab07474b..73484a19 100644 --- a/examples/named_tuple/all.cr +++ b/examples/named_tuple/all.cr @@ -91,45 +91,45 @@ tuple.each do |key, value| puts "#{key} = #{value}" end -# named_tuple.cr:302 (015.cr) +# named_tuple.cr:301 (015.cr) tuple = {name: "Crystal", year: 2011} tuple.each_key do |key| puts key end -# named_tuple.cr:324 (016.cr) +# named_tuple.cr:322 (016.cr) tuple = {name: "Crystal", year: 2011} tuple.each_value do |value| puts value end -# named_tuple.cr:346 (017.cr) +# named_tuple.cr:343 (017.cr) tuple = {name: "Crystal", year: 2011} tuple.each_with_index do |key, value, i| puts "#{i + 1}) #{key} = #{value}" end -# named_tuple.cr:371 (018.cr) +# named_tuple.cr:367 (018.cr) tuple = {name: "Crystal", year: 2011} tuple.map { |k, v| "#{k}: #{v}" } # => ["name: Crystal", "year: 2011"] -# named_tuple.cr:385 (019.cr) +# named_tuple.cr:381 (019.cr) tuple = {name: "Crystal", year: 2011} tuple.to_a # => [{:name, "Crystal"}, {:year, 2011}] -# named_tuple.cr:399 (020.cr) +# named_tuple.cr:395 (020.cr) tuple = {name: "Crystal", year: 2011} tuple.to_h # => {:name => "Crystal", :year => 2011} -# named_tuple.cr:415 (021.cr) +# named_tuple.cr:411 (021.cr) tuple = {name: "Crystal", year: 2011} tuple.size # => 2 -# named_tuple.cr:425 (022.cr) +# named_tuple.cr:421 (022.cr) tuple = {name: "Crystal", year: 2011} tuple.empty? # => false -# named_tuple.cr:436 (023.cr) +# named_tuple.cr:432 (023.cr) tuple1 = {name: "Crystal", year: 2011} tuple2 = {year: 2011, name: "Crystal"} tuple3 = {name: "Crystal", year: 2012} diff --git a/examples/pointer/001.cr b/examples/pointer/001.cr index 9c46ebfe..6c8f535f 100644 --- a/examples/pointer/001.cr +++ b/examples/pointer/001.cr @@ -2,4 +2,4 @@ x = 1 ptr = pointerof(x) ptr.value = 2 -puts x # => 2 +x # => 2 diff --git a/examples/pointer/all.cr b/examples/pointer/all.cr index f793c19b..5d70813a 100644 --- a/examples/pointer/all.cr +++ b/examples/pointer/all.cr @@ -4,7 +4,7 @@ x = 1 ptr = pointerof(x) ptr.value = 2 -puts x # => 2 +x # => 2 # pointer.cr:59 (002.cr) a = 1 diff --git a/examples/range/009.cr b/examples/range/009.cr index d5a94212..55638eda 100644 --- a/examples/range/009.cr +++ b/examples/range/009.cr @@ -1,2 +1,2 @@ -# range.cr:113 +# range.cr:112 (1..3).each.skip(1).to_a # => [2, 3] diff --git a/examples/range/010.cr b/examples/range/010.cr index 57a2b7d1..f2aba0f4 100644 --- a/examples/range/010.cr +++ b/examples/range/010.cr @@ -1,3 +1,3 @@ -# range.cr:122 +# range.cr:121 (10...15).reverse_each { |n| print n, ' ' } # prints: 14 13 12 11 10 diff --git a/examples/range/011.cr b/examples/range/011.cr index e7145f9a..9770dd1b 100644 --- a/examples/range/011.cr +++ b/examples/range/011.cr @@ -1,2 +1,2 @@ -# range.cr:138 +# range.cr:136 (1..3).reverse_each.skip(1).to_a # => [2, 1] diff --git a/examples/range/012.cr b/examples/range/012.cr index c43335fc..698c72fa 100644 --- a/examples/range/012.cr +++ b/examples/range/012.cr @@ -1,4 +1,4 @@ -# range.cr:147 +# range.cr:145 range = Xs.new(1)..Xs.new(10) range.step(2) { |x| puts x } puts diff --git a/examples/range/013.cr b/examples/range/013.cr index 819ea558..140e8ed7 100644 --- a/examples/range/013.cr +++ b/examples/range/013.cr @@ -1,2 +1,2 @@ -# range.cr:182 +# range.cr:180 (1..10).step(3).skip(1).to_a # => [4, 7, 10] diff --git a/examples/range/014.cr b/examples/range/014.cr index dde39779..0fd703b7 100644 --- a/examples/range/014.cr +++ b/examples/range/014.cr @@ -1,3 +1,3 @@ -# range.cr:191 +# range.cr:189 (1..10).excludes_end? # => false (1...10).excludes_end? # => true diff --git a/examples/range/015.cr b/examples/range/015.cr index a44a1b4f..af78476b 100644 --- a/examples/range/015.cr +++ b/examples/range/015.cr @@ -1,4 +1,4 @@ -# range.cr:201 +# range.cr:199 (1..10).includes?(4) # => true (1..10).includes?(10) # => true (1..10).includes?(11) # => false diff --git a/examples/range/016.cr b/examples/range/016.cr index eb30536a..ca98ae6e 100644 --- a/examples/range/016.cr +++ b/examples/range/016.cr @@ -1,4 +1,4 @@ -# range.cr:224 +# range.cr:222 case 79 when 1..50 then puts "low" when 51..75 then puts "medium" diff --git a/examples/range/all.cr b/examples/range/all.cr index 633006d6..13dafb34 100644 --- a/examples/range/all.cr +++ b/examples/range/all.cr @@ -58,30 +58,30 @@ Range.new(1, 10, exclusive: true) # => 1...10 (10..15).each { |n| print n, ' ' } # prints: 10 11 12 13 14 15 -# range.cr:113 (009.cr) +# range.cr:112 (009.cr) (1..3).each.skip(1).to_a # => [2, 3] -# range.cr:122 (010.cr) +# range.cr:121 (010.cr) (10...15).reverse_each { |n| print n, ' ' } # prints: 14 13 12 11 10 -# range.cr:138 (011.cr) +# range.cr:136 (011.cr) (1..3).reverse_each.skip(1).to_a # => [2, 1] -# range.cr:147 (012.cr) +# range.cr:145 (012.cr) range = Xs.new(1)..Xs.new(10) range.step(2) { |x| puts x } puts range.step(3) { |x| puts x } -# range.cr:182 (013.cr) +# range.cr:180 (013.cr) (1..10).step(3).skip(1).to_a # => [4, 7, 10] -# range.cr:191 (014.cr) +# range.cr:189 (014.cr) (1..10).excludes_end? # => false (1...10).excludes_end? # => true -# range.cr:201 (015.cr) +# range.cr:199 (015.cr) (1..10).includes?(4) # => true (1..10).includes?(10) # => true (1..10).includes?(11) # => false @@ -89,7 +89,7 @@ range.step(3) { |x| puts x } (1...10).includes?(9) # => true (1...10).includes?(10) # => false -# range.cr:224 (016.cr) +# range.cr:222 (016.cr) case 79 when 1..50 then puts "low" when 51..75 then puts "medium" diff --git a/examples/set/011.cr b/examples/set/011.cr index 3a60a041..3ff4fd82 100644 --- a/examples/set/011.cr +++ b/examples/set/011.cr @@ -1,3 +1,3 @@ -# set.cr:157 +# set.cr:156 Set{1, 1, 3, 5} & Set{1, 2, 3} # => Set{1, 3} Set{'a', 'b', 'b', 'z'} & Set{'a', 'b', 'c'} # => Set{'a', 'b'} diff --git a/examples/set/012.cr b/examples/set/012.cr index 716013ba..71fcee4c 100644 --- a/examples/set/012.cr +++ b/examples/set/012.cr @@ -1,3 +1,3 @@ -# set.cr:171 +# set.cr:170 Set{1, 1, 3, 5} | Set{1, 2, 3} # => Set{1, 3, 5, 2} Set{'a', 'b', 'b', 'z'} | Set{'a', 'b', 'c'} # => Set{'a', 'b', 'z', 'c'} diff --git a/examples/set/013.cr b/examples/set/013.cr index 89c9bd15..fed1e0f8 100644 --- a/examples/set/013.cr +++ b/examples/set/013.cr @@ -1,3 +1,3 @@ -# set.cr:187 +# set.cr:186 Set{1, 2, 3, 4, 5} - Set{2, 4} # => Set{1, 3, 5} Set{'a', 'b', 'b', 'z'} - Set{'a', 'b', 'c'} # => Set{'z'} diff --git a/examples/set/014.cr b/examples/set/014.cr index 4e153769..bfd03acb 100644 --- a/examples/set/014.cr +++ b/examples/set/014.cr @@ -1,3 +1,3 @@ -# set.cr:202 +# set.cr:201 Set{1, 2, 3, 4, 5} - [2, 4] # => Set{1, 3, 5} Set{'a', 'b', 'b', 'z'} - ['a', 'b', 'c'] # => Set{'z'} diff --git a/examples/set/015.cr b/examples/set/015.cr index 1d6537ca..086a08ff 100644 --- a/examples/set/015.cr +++ b/examples/set/015.cr @@ -1,3 +1,3 @@ -# set.cr:213 +# set.cr:212 Set{1, 2, 3, 4, 5} ^ Set{2, 4, 6} # => Set{1, 3, 5, 6} Set{'a', 'b', 'b', 'z'} ^ Set{'a', 'b', 'c'} # => Set{'z', 'c'} diff --git a/examples/set/016.cr b/examples/set/016.cr index 7b11e133..d2e921cf 100644 --- a/examples/set/016.cr +++ b/examples/set/016.cr @@ -1,3 +1,3 @@ -# set.cr:231 +# set.cr:230 Set{1, 2, 3, 4, 5} ^ [2, 4, 6] # => Set{1, 3, 5, 6} Set{'a', 'b', 'b', 'z'} ^ ['a', 'b', 'c'] # => Set{'z', 'c'} diff --git a/examples/set/017.cr b/examples/set/017.cr index ba1ca87d..8ff371af 100644 --- a/examples/set/017.cr +++ b/examples/set/017.cr @@ -1,3 +1,3 @@ -# set.cr:250 +# set.cr:249 Set{'a', 'b', 'b', 'z'}.subtract Set{'a', 'b', 'c'} # => Set{'z'} Set{1, 2, 3, 4, 5}.subtract [2, 4, 6] # => Set{1, 3, 5} diff --git a/examples/set/018.cr b/examples/set/018.cr index d09541d4..1d85dcab 100644 --- a/examples/set/018.cr +++ b/examples/set/018.cr @@ -1,2 +1,2 @@ -# set.cr:263 +# set.cr:262 Set{1, 5} == Set{1, 5} # => true diff --git a/examples/set/019.cr b/examples/set/019.cr index 39ecf715..cb158ec2 100644 --- a/examples/set/019.cr +++ b/examples/set/019.cr @@ -1,2 +1,2 @@ -# set.cr:286 +# set.cr:285 Set{1, 5}.to_a # => [1,5] diff --git a/examples/set/020.cr b/examples/set/020.cr index ab88d825..b2f37218 100644 --- a/examples/set/020.cr +++ b/examples/set/020.cr @@ -1,3 +1,3 @@ -# set.cr:309 +# set.cr:308 Set{1, 2, 3}.intersects? Set{4, 5} # => false Set{1, 2, 3}.intersects? Set{3, 4} # => true diff --git a/examples/set/021.cr b/examples/set/021.cr index be20f202..561a9fb7 100644 --- a/examples/set/021.cr +++ b/examples/set/021.cr @@ -1,3 +1,3 @@ -# set.cr:333 +# set.cr:332 Set{1, 5}.subset? Set{1, 3, 5} # => true Set{1, 3, 5}.subset? Set{1, 3, 5} # => true diff --git a/examples/set/022.cr b/examples/set/022.cr index 8f47cdfb..fbc22bdc 100644 --- a/examples/set/022.cr +++ b/examples/set/022.cr @@ -1,3 +1,3 @@ -# set.cr:347 +# set.cr:346 Set{1, 5}.proper_subset? Set{1, 3, 5} # => true Set{1, 3, 5}.proper_subset? Set{1, 3, 5} # => false diff --git a/examples/set/023.cr b/examples/set/023.cr index 1d902b18..1da7f5dc 100644 --- a/examples/set/023.cr +++ b/examples/set/023.cr @@ -1,3 +1,3 @@ -# set.cr:361 +# set.cr:360 Set{1, 3, 5}.superset? Set{1, 5} # => true Set{1, 3, 5}.superset? Set{1, 3, 5} # => true diff --git a/examples/set/024.cr b/examples/set/024.cr index 6c241883..5ce4f74e 100644 --- a/examples/set/024.cr +++ b/examples/set/024.cr @@ -1,3 +1,3 @@ -# set.cr:374 +# set.cr:373 Set{1, 3, 5}.proper_superset? Set{1, 5} # => true Set{1, 3, 5}.proper_superset? Set{1, 3, 5} # => false diff --git a/examples/set/all.cr b/examples/set/all.cr index 6e38ceae..d00b734a 100644 --- a/examples/set/all.cr +++ b/examples/set/all.cr @@ -58,56 +58,56 @@ s.empty? # => true s << 3 s.empty? # => false -# set.cr:157 (011.cr) +# set.cr:156 (011.cr) Set{1, 1, 3, 5} & Set{1, 2, 3} # => Set{1, 3} Set{'a', 'b', 'b', 'z'} & Set{'a', 'b', 'c'} # => Set{'a', 'b'} -# set.cr:171 (012.cr) +# set.cr:170 (012.cr) Set{1, 1, 3, 5} | Set{1, 2, 3} # => Set{1, 3, 5, 2} Set{'a', 'b', 'b', 'z'} | Set{'a', 'b', 'c'} # => Set{'a', 'b', 'z', 'c'} -# set.cr:187 (013.cr) +# set.cr:186 (013.cr) Set{1, 2, 3, 4, 5} - Set{2, 4} # => Set{1, 3, 5} Set{'a', 'b', 'b', 'z'} - Set{'a', 'b', 'c'} # => Set{'z'} -# set.cr:202 (014.cr) +# set.cr:201 (014.cr) Set{1, 2, 3, 4, 5} - [2, 4] # => Set{1, 3, 5} Set{'a', 'b', 'b', 'z'} - ['a', 'b', 'c'] # => Set{'z'} -# set.cr:213 (015.cr) +# set.cr:212 (015.cr) Set{1, 2, 3, 4, 5} ^ Set{2, 4, 6} # => Set{1, 3, 5, 6} Set{'a', 'b', 'b', 'z'} ^ Set{'a', 'b', 'c'} # => Set{'z', 'c'} -# set.cr:231 (016.cr) +# set.cr:230 (016.cr) Set{1, 2, 3, 4, 5} ^ [2, 4, 6] # => Set{1, 3, 5, 6} Set{'a', 'b', 'b', 'z'} ^ ['a', 'b', 'c'] # => Set{'z', 'c'} -# set.cr:250 (017.cr) +# set.cr:249 (017.cr) Set{'a', 'b', 'b', 'z'}.subtract Set{'a', 'b', 'c'} # => Set{'z'} Set{1, 2, 3, 4, 5}.subtract [2, 4, 6] # => Set{1, 3, 5} -# set.cr:263 (018.cr) +# set.cr:262 (018.cr) Set{1, 5} == Set{1, 5} # => true -# set.cr:286 (019.cr) +# set.cr:285 (019.cr) Set{1, 5}.to_a # => [1,5] -# set.cr:309 (020.cr) +# set.cr:308 (020.cr) Set{1, 2, 3}.intersects? Set{4, 5} # => false Set{1, 2, 3}.intersects? Set{3, 4} # => true -# set.cr:333 (021.cr) +# set.cr:332 (021.cr) Set{1, 5}.subset? Set{1, 3, 5} # => true Set{1, 3, 5}.subset? Set{1, 3, 5} # => true -# set.cr:347 (022.cr) +# set.cr:346 (022.cr) Set{1, 5}.proper_subset? Set{1, 3, 5} # => true Set{1, 3, 5}.proper_subset? Set{1, 3, 5} # => false -# set.cr:361 (023.cr) +# set.cr:360 (023.cr) Set{1, 3, 5}.superset? Set{1, 5} # => true Set{1, 3, 5}.superset? Set{1, 3, 5} # => true -# set.cr:374 (024.cr) +# set.cr:373 (024.cr) Set{1, 3, 5}.proper_superset? Set{1, 5} # => true Set{1, 3, 5}.proper_superset? Set{1, 3, 5} # => false diff --git a/examples/static_array/009.cr b/examples/static_array/009.cr index a7fc76d7..7be6cd3f 100644 --- a/examples/static_array/009.cr +++ b/examples/static_array/009.cr @@ -1,4 +1,4 @@ # static_array.cr:131 array = StaticArray(Int32, 3).new { |i| i + 1 } -array.[]= 2 # => 3 +array.[]= 2 # => nil array # => StaticArray[2, 2, 2] diff --git a/examples/static_array/all.cr b/examples/static_array/all.cr index 1f9eae19..aced3558 100644 --- a/examples/static_array/all.cr +++ b/examples/static_array/all.cr @@ -41,7 +41,7 @@ array.size # => 3 # static_array.cr:131 (009.cr) array = StaticArray(Int32, 3).new { |i| i + 1 } -array.[]= 2 # => 3 +array.[]= 2 # => nil array # => StaticArray[2, 2, 2] # static_array.cr:145 (010.cr) diff --git a/examples/string/103.cr b/examples/string/103.cr index a5ce5f51..1a826950 100644 --- a/examples/string/103.cr +++ b/examples/string/103.cr @@ -1,4 +1,4 @@ -# string.cr:3172 +# string.cr:3171 chars = "ab☃".each_char chars.next # => 'a' chars.next # => 'b' diff --git a/examples/string/104.cr b/examples/string/104.cr index 4ab4a8f8..d6db28c7 100644 --- a/examples/string/104.cr +++ b/examples/string/104.cr @@ -1,4 +1,4 @@ -# string.cr:3184 +# string.cr:3183 array = [] of Tuple(Char, Int32) "ab☃".each_char_with_index do |char, index| array << {char, index} diff --git a/examples/string/105.cr b/examples/string/105.cr index c1b512ab..439e5b28 100644 --- a/examples/string/105.cr +++ b/examples/string/105.cr @@ -1,2 +1,2 @@ -# string.cr:3202 +# string.cr:3200 "ab☃".chars # => ['a', 'b', '☃'] diff --git a/examples/string/106.cr b/examples/string/106.cr index 3d853e44..e98b6d2e 100644 --- a/examples/string/106.cr +++ b/examples/string/106.cr @@ -1,4 +1,4 @@ -# string.cr:3215 +# string.cr:3213 array = [] of Int32 "ab☃".each_codepoint do |codepoint| array << codepoint diff --git a/examples/string/107.cr b/examples/string/107.cr index c3c8d330..893bc75c 100644 --- a/examples/string/107.cr +++ b/examples/string/107.cr @@ -1,4 +1,4 @@ -# string.cr:3232 +# string.cr:3230 codepoints = "ab☃".each_codepoint codepoints.next # => 97 codepoints.next # => 98 diff --git a/examples/string/108.cr b/examples/string/108.cr index 00853276..656c12d9 100644 --- a/examples/string/108.cr +++ b/examples/string/108.cr @@ -1,2 +1,2 @@ -# string.cr:3246 +# string.cr:3244 "ab☃".codepoints # => [97, 98, 9731] diff --git a/examples/string/109.cr b/examples/string/109.cr index 70ad62e5..5938e18e 100644 --- a/examples/string/109.cr +++ b/examples/string/109.cr @@ -1,4 +1,4 @@ -# string.cr:3261 +# string.cr:3259 array = [] of UInt8 "ab☃".each_byte do |byte| array << byte diff --git a/examples/string/110.cr b/examples/string/110.cr index 747dcb77..6e31cbe1 100644 --- a/examples/string/110.cr +++ b/examples/string/110.cr @@ -1,4 +1,4 @@ -# string.cr:3277 +# string.cr:3275 bytes = "ab☃".each_byte bytes.next # => 97 bytes.next # => 98 diff --git a/examples/string/111.cr b/examples/string/111.cr index 980436ae..b8f213c8 100644 --- a/examples/string/111.cr +++ b/examples/string/111.cr @@ -1,3 +1,3 @@ -# string.cr:3291 +# string.cr:3289 "hello".bytes # => [104, 101, 108, 108, 111] "你好".bytes # => [228, 189, 160, 229, 165, 189] diff --git a/examples/string/112.cr b/examples/string/112.cr index fbb8cbae..56bb014c 100644 --- a/examples/string/112.cr +++ b/examples/string/112.cr @@ -1,2 +1,2 @@ -# string.cr:3441 +# string.cr:3439 "Party like it's %d!!!" % 1999 # => "Party like it's 1999!!!" diff --git a/examples/string/113.cr b/examples/string/113.cr index 34f21e9f..1c9d558d 100644 --- a/examples/string/113.cr +++ b/examples/string/113.cr @@ -1,3 +1,3 @@ -# string.cr:3461 +# string.cr:3459 "hello".size # => 5 "你好".size # => 2 diff --git a/examples/string/all.cr b/examples/string/all.cr index 1bfbfbde..ba063e13 100644 --- a/examples/string/all.cr +++ b/examples/string/all.cr @@ -538,46 +538,46 @@ array = [] of Char end array # => ['a', 'b', '☃'] -# string.cr:3172 (103.cr) +# string.cr:3171 (103.cr) chars = "ab☃".each_char chars.next # => 'a' chars.next # => 'b' chars.next # => '☃' -# string.cr:3184 (104.cr) +# string.cr:3183 (104.cr) array = [] of Tuple(Char, Int32) "ab☃".each_char_with_index do |char, index| array << {char, index} end array # => [{'a', 0}, {'b', 1}, {'☃', 2}] -# string.cr:3202 (105.cr) +# string.cr:3200 (105.cr) "ab☃".chars # => ['a', 'b', '☃'] -# string.cr:3215 (106.cr) +# string.cr:3213 (106.cr) array = [] of Int32 "ab☃".each_codepoint do |codepoint| array << codepoint end array # => [97, 98, 9731] -# string.cr:3232 (107.cr) +# string.cr:3230 (107.cr) codepoints = "ab☃".each_codepoint codepoints.next # => 97 codepoints.next # => 98 codepoints.next # => 9731 -# string.cr:3246 (108.cr) +# string.cr:3244 (108.cr) "ab☃".codepoints # => [97, 98, 9731] -# string.cr:3261 (109.cr) +# string.cr:3259 (109.cr) array = [] of UInt8 "ab☃".each_byte do |byte| array << byte end array # => [97, 98, 226, 152, 131] -# string.cr:3277 (110.cr) +# string.cr:3275 (110.cr) bytes = "ab☃".each_byte bytes.next # => 97 bytes.next # => 98 @@ -585,13 +585,13 @@ bytes.next # => 226 bytes.next # => 152 bytes.next # => 131 -# string.cr:3291 (111.cr) +# string.cr:3289 (111.cr) "hello".bytes # => [104, 101, 108, 108, 111] "你好".bytes # => [228, 189, 160, 229, 165, 189] -# string.cr:3441 (112.cr) +# string.cr:3439 (112.cr) "Party like it's %d!!!" % 1999 # => "Party like it's 1999!!!" -# string.cr:3461 (113.cr) +# string.cr:3459 (113.cr) "hello".size # => 5 "你好".size # => 2 diff --git a/examples/tuple/013.cr b/examples/tuple/013.cr index 8b1ed8c9..b8199e83 100644 --- a/examples/tuple/013.cr +++ b/examples/tuple/013.cr @@ -1,4 +1,4 @@ -# tuple.cr:210 +# tuple.cr:209 t1 = {1, "hello"} t2 = {1.0, "hello"} t3 = {2, "hello"} diff --git a/examples/tuple/014.cr b/examples/tuple/014.cr index 0e2b9457..0f23be06 100644 --- a/examples/tuple/014.cr +++ b/examples/tuple/014.cr @@ -1,3 +1,3 @@ -# tuple.cr:241 +# tuple.cr:240 {1, 2} === {1, 2} # => true {1, 2} === {1, 3} # => false diff --git a/examples/tuple/015.cr b/examples/tuple/015.cr index ae9fa163..23341cff 100644 --- a/examples/tuple/015.cr +++ b/examples/tuple/015.cr @@ -1,3 +1,3 @@ -# tuple.cr:257 +# tuple.cr:256 {1, 2} === {1, 2, 3} # => false {/o+/, "bar"} === {"foo", "bar"} # => true diff --git a/examples/tuple/016.cr b/examples/tuple/016.cr index c64be516..4947d573 100644 --- a/examples/tuple/016.cr +++ b/examples/tuple/016.cr @@ -1,4 +1,4 @@ -# tuple.cr:286 +# tuple.cr:285 {"a", "a", "c"} <=> {"a", "b", "c"} # => -1 {1, 2, 3, 4, 5, 6} <=> {1, 2} # => +1 {1, 2} <=> {1, 2.0} # => 0 diff --git a/examples/tuple/017.cr b/examples/tuple/017.cr index 79bb17c3..c0764886 100644 --- a/examples/tuple/017.cr +++ b/examples/tuple/017.cr @@ -1,4 +1,4 @@ -# tuple.cr:335 +# tuple.cr:334 t1 = {1, 2} t2 = {"foo", "bar"} t3 = t1 + t2 diff --git a/examples/tuple/018.cr b/examples/tuple/018.cr index 71b5b0fb..604e0fb0 100644 --- a/examples/tuple/018.cr +++ b/examples/tuple/018.cr @@ -1,2 +1,2 @@ -# tuple.cr:361 +# tuple.cr:360 {'a', 'b'}.size # => 2 diff --git a/examples/tuple/019.cr b/examples/tuple/019.cr index 8ebf1879..acc2ecf7 100644 --- a/examples/tuple/019.cr +++ b/examples/tuple/019.cr @@ -1,3 +1,3 @@ -# tuple.cr:370 +# tuple.cr:369 tuple = {1, "hello", 'x'} tuple.types # => Tuple(Int32, String, Char) diff --git a/examples/tuple/020.cr b/examples/tuple/020.cr index 94ffca0d..399e6fa6 100644 --- a/examples/tuple/020.cr +++ b/examples/tuple/020.cr @@ -1,3 +1,3 @@ -# tuple.cr:385 +# tuple.cr:384 tuple = {1, "hello"} tuple.to_s # => "{1, \"hello\"}" diff --git a/examples/tuple/021.cr b/examples/tuple/021.cr index 17cd3cbd..89a770fa 100644 --- a/examples/tuple/021.cr +++ b/examples/tuple/021.cr @@ -1,3 +1,3 @@ -# tuple.cr:401 +# tuple.cr:400 tuple = {1, 2.5, "a"} tuple.map &.to_s # => {"1", "2.5", "a"} diff --git a/examples/tuple/022.cr b/examples/tuple/022.cr index 0da2bc4a..b79081de 100644 --- a/examples/tuple/022.cr +++ b/examples/tuple/022.cr @@ -1,3 +1,3 @@ -# tuple.cr:417 +# tuple.cr:416 tuple = {1, 2.5, "a"} tuple.reverse # => {"a", 2.5, 1} diff --git a/examples/tuple/023.cr b/examples/tuple/023.cr index c919a553..53ac8ac4 100644 --- a/examples/tuple/023.cr +++ b/examples/tuple/023.cr @@ -1,4 +1,4 @@ -# tuple.cr:433 +# tuple.cr:432 tuple = {1, "hello", 'x'} tuple.reverse_each do |value| puts value diff --git a/examples/tuple/024.cr b/examples/tuple/024.cr index 2b21faa4..d20c8d77 100644 --- a/examples/tuple/024.cr +++ b/examples/tuple/024.cr @@ -1,3 +1,3 @@ -# tuple.cr:457 +# tuple.cr:456 tuple = {1, 2.5} tuple.first # => 1 diff --git a/examples/tuple/025.cr b/examples/tuple/025.cr index 8aa1bf9a..e9543b32 100644 --- a/examples/tuple/025.cr +++ b/examples/tuple/025.cr @@ -1,4 +1,4 @@ -# tuple.cr:467 +# tuple.cr:466 tuple = {1, 2.5} tuple.first? # => 1 diff --git a/examples/tuple/026.cr b/examples/tuple/026.cr index 69bbb4c0..5fb8b68c 100644 --- a/examples/tuple/026.cr +++ b/examples/tuple/026.cr @@ -1,3 +1,3 @@ -# tuple.cr:485 +# tuple.cr:484 tuple = {1, 2.5} tuple.last # => 2.5 diff --git a/examples/tuple/027.cr b/examples/tuple/027.cr index 5246637d..98ebab33 100644 --- a/examples/tuple/027.cr +++ b/examples/tuple/027.cr @@ -1,4 +1,4 @@ -# tuple.cr:498 +# tuple.cr:497 tuple = {1, 2.5} tuple.last? # => 2.5 diff --git a/examples/tuple/all.cr b/examples/tuple/all.cr index 6d2d7dbd..3700da43 100644 --- a/examples/tuple/all.cr +++ b/examples/tuple/all.cr @@ -85,7 +85,7 @@ tuple.each do |value| puts value end -# tuple.cr:210 (013.cr) +# tuple.cr:209 (013.cr) t1 = {1, "hello"} t2 = {1.0, "hello"} t3 = {2, "hello"} @@ -93,67 +93,67 @@ t3 = {2, "hello"} t1 == t2 # => true t1 == t3 # => false -# tuple.cr:241 (014.cr) +# tuple.cr:240 (014.cr) {1, 2} === {1, 2} # => true {1, 2} === {1, 3} # => false -# tuple.cr:257 (015.cr) +# tuple.cr:256 (015.cr) {1, 2} === {1, 2, 3} # => false {/o+/, "bar"} === {"foo", "bar"} # => true -# tuple.cr:286 (016.cr) +# tuple.cr:285 (016.cr) {"a", "a", "c"} <=> {"a", "b", "c"} # => -1 {1, 2, 3, 4, 5, 6} <=> {1, 2} # => +1 {1, 2} <=> {1, 2.0} # => 0 -# tuple.cr:335 (017.cr) +# tuple.cr:334 (017.cr) t1 = {1, 2} t2 = {"foo", "bar"} t3 = t1 + t2 t3 # => {1, 2, "foo", "bar"} typeof(t3) # => Tuple(Int32, Int32, String, String) -# tuple.cr:361 (018.cr) +# tuple.cr:360 (018.cr) {'a', 'b'}.size # => 2 -# tuple.cr:370 (019.cr) +# tuple.cr:369 (019.cr) tuple = {1, "hello", 'x'} tuple.types # => Tuple(Int32, String, Char) -# tuple.cr:385 (020.cr) +# tuple.cr:384 (020.cr) tuple = {1, "hello"} tuple.to_s # => "{1, \"hello\"}" -# tuple.cr:401 (021.cr) +# tuple.cr:400 (021.cr) tuple = {1, 2.5, "a"} tuple.map &.to_s # => {"1", "2.5", "a"} -# tuple.cr:417 (022.cr) +# tuple.cr:416 (022.cr) tuple = {1, 2.5, "a"} tuple.reverse # => {"a", 2.5, 1} -# tuple.cr:433 (023.cr) +# tuple.cr:432 (023.cr) tuple = {1, "hello", 'x'} tuple.reverse_each do |value| puts value end -# tuple.cr:457 (024.cr) +# tuple.cr:456 (024.cr) tuple = {1, 2.5} tuple.first # => 1 -# tuple.cr:467 (025.cr) +# tuple.cr:466 (025.cr) tuple = {1, 2.5} tuple.first? # => 1 empty = Tuple.new empty.first? # => nil -# tuple.cr:485 (026.cr) +# tuple.cr:484 (026.cr) tuple = {1, 2.5} tuple.last # => 2.5 -# tuple.cr:498 (027.cr) +# tuple.cr:497 (027.cr) tuple = {1, 2.5} tuple.last? # => 2.5 diff --git a/gen/spec/array_spec.cr b/gen/spec/array_spec.cr index de488754..033b812a 100644 --- a/gen/spec/array_spec.cr +++ b/gen/spec/array_spec.cr @@ -33,17 +33,17 @@ puts "# array.cr:93 (007.cr)" # :nocode: :example: ( Array.new(3, 'a') ).should eq( ['a', 'a', 'a'] ) ary = Array.new(3, [1]) -( ary ).to_s.should eq( "[[1], [1], [1]]" ) +( ary ).should eq( [[1], [1], [1]] ) ary[0][0] = 2 -( ary ).to_s.should eq( "[[2], [2], [2]]" ) +( ary ).should eq( [[2], [2], [2]] ) puts "# array.cr:119 (008.cr)" # :nocode: :example: ( Array.new(3) { |i| (i + 1) ** 2 } ).should eq( [1, 4, 9] ) ary = Array.new(3) { [1] } -( ary ).to_s.should eq( "[[1], [1], [1]]" ) +( ary ).should eq( [[1], [1], [1]] ) ary[0][0] = 2 -( ary ).to_s.should eq( "[[2], [1], [1]]" ) +( ary ).should eq( [[2], [1], [1]] ) puts "# array.cr:142 (009.cr)" # :nocode: :example: # pending by 'file:pendings/array/009.cr' # :pending: @@ -156,12 +156,12 @@ puts "# array.cr:520 (026.cr)" # :nocode: :example: ary = [[1, 2], [3, 4]] ary2 = ary.clone ary[0][0] = 5 -( ary ).to_s.should eq( "[[5, 2], [3, 4]]" ) -( ary2 ).to_s.should eq( "[[1, 2], [3, 4]]" ) +( ary ).should eq( [[5, 2], [3, 4]] ) +( ary2 ).should eq( [[1, 2], [3, 4]] ) ary2 << [7, 8] -( ary ).to_s.should eq( "[[5, 2], [3, 4]]" ) -( ary2 ).to_s.should eq( "[[1, 2], [3, 4], [7, 8]]" ) +( ary ).should eq( [[5, 2], [3, 4]] ) +( ary2 ).should eq( [[1, 2], [3, 4], [7, 8]] ) puts "# array.cr:537 (027.cr)" # :nocode: :example: ( ["a", nil, "b", nil, "c", nil].compact ).should eq( ["a", "b", "c"] ) @@ -206,12 +206,12 @@ puts "# array.cr:673 (034.cr)" # :nocode: :example: ary = [[1, 2], [3, 4]] ary2 = ary.dup ary[0][0] = 5 -( ary ).to_s.should eq( "[[5, 2], [3, 4]]" ) -( ary2 ).to_s.should eq( "[[5, 2], [3, 4]]" ) +( ary ).should eq( [[5, 2], [3, 4]] ) +( ary2 ).should eq( [[5, 2], [3, 4]] ) ary2 << [7, 8] -( ary ).to_s.should eq( "[[5, 2], [3, 4]]" ) -( ary2 ).to_s.should eq( "[[5, 2], [3, 4], [7, 8]]" ) +( ary ).should eq( [[5, 2], [3, 4]] ) +( ary2 ).should eq( [[5, 2], [3, 4], [7, 8]] ) puts "# array.cr:694 (035.cr)" # :nocode: :example: a = [1, 2, 3, 4] @@ -276,7 +276,7 @@ a = [1, 2, 3] puts "# array.cr:960 (048.cr)" # :nocode: :example: a = [1, 2, 3] sums = [] of Int32 -( a.each_permutation(2) { |p| sums << p.sum } ).should eq( [1, 2, 3] ) +( a.each_permutation(2) { |p| sums << p.sum } ).should eq( nil ) ( sums ).should eq( [3, 4, 3, 5, 4, 5] ) puts "# array.cr:1009 (049.cr)" # :nocode: :example: @@ -296,17 +296,17 @@ u = [9, [10, 11].each] # => [9, #] a = [s, t, u, 12, 13] # => [[1, 2, 3], [4, 5, 6, [7, 8]], 9, #, 12, 13] ( a.flatten ).should eq( [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] ) -puts "# array.cr:1246 (051.cr)" # :nocode: :example: +puts "# array.cr:1244 (051.cr)" # :nocode: :example: a = ["a", "b", "c"] ( a.pop ).to_s.should eq( "c" ) ( a ).should eq( ["a", "b"] ) -puts "# array.cr:1258 (052.cr)" # :nocode: :example: +puts "# array.cr:1256 (052.cr)" # :nocode: :example: a = [1] ( a.pop { "Testing" } ).should eq( 1 ) ( a.pop { "Testing" } ).to_s.should eq( "Testing" ) -puts "# array.cr:1280 (053.cr)" # :nocode: :example: +puts "# array.cr:1278 (053.cr)" # :nocode: :example: a = ["a", "b", "c"] ( a.pop(2) ).should eq( ["b", "c"] ) ( a ).should eq( ["a"] ) @@ -315,7 +315,7 @@ a = ["a", "b", "c"] ( a.pop(4) ).should eq( ["a", "b", "c"] ) ( a ).to_s.should eq( "[]" ) -puts "# array.cr:1325 (054.cr)" # :nocode: :example: +puts "# array.cr:1323 (054.cr)" # :nocode: :example: a = ["a", "b"] ( a.push("c") ).should eq( ["a", "b", "c"] ) # a.push(1) # Errors, because the array only accepts String. @@ -324,25 +324,25 @@ a = ["a", "b"] of (Int32 | String) ( a.push("c") ).should eq( ["a", "b", "c"] ) ( a.push(1) ).should eq( ["a", "b", "c", 1] ) -puts "# array.cr:1344 (055.cr)" # :nocode: :example: +puts "# array.cr:1342 (055.cr)" # :nocode: :example: a = ["a"] ( a.push("b", "c") ).should eq( ["a", "b", "c"] ) -puts "# array.cr:1367 (056.cr)" # :nocode: :example: +puts "# array.cr:1365 (056.cr)" # :nocode: :example: a = [1, 2, 3] ( a.reverse ).should eq( [3, 2, 1] ) -puts "# array.cr:1413 (057.cr)" # :nocode: :example: +puts "# array.cr:1411 (057.cr)" # :nocode: :example: a = [1, 2, 3] a.sample(2) # => [2, 1] a.sample(2, Random.new(1)) # => [1, 3] -puts "# array.cr:1451 (058.cr)" # :nocode: :example: +puts "# array.cr:1449 (058.cr)" # :nocode: :example: a = ["a", "b", "c"] ( a.shift ).to_s.should eq( "a" ) ( a ).should eq( ["b", "c"] ) -puts "# array.cr:1478 (059.cr)" # :nocode: :example: +puts "# array.cr:1476 (059.cr)" # :nocode: :example: a = ["a", "b", "c"] ( a.shift ).to_s.should eq( "a" ) ( a ).should eq( ["b", "c"] ) @@ -351,46 +351,46 @@ a = ["a", "b", "c"] ( a.shift(4) ).should eq( ["a", "b", "c"] ) ( a ).to_s.should eq( "[]" ) -puts "# array.cr:1521 (060.cr)" # :nocode: :example: +puts "# array.cr:1519 (060.cr)" # :nocode: :example: a = [3, 1, 2] ( a.sort ).should eq( [1, 2, 3] ) ( a ).should eq( [3, 1, 2] ) -puts "# array.cr:1539 (061.cr)" # :nocode: :example: +puts "# array.cr:1537 (061.cr)" # :nocode: :example: a = [3, 1, 2] a.sort! ( a ).should eq( [1, 2, 3] ) -puts "# array.cr:1607 (062.cr)" # :nocode: :example: +puts "# array.cr:1605 (062.cr)" # :nocode: :example: ary = [1, 2, 3] ( ary.to_unsafe[0] ).should eq( 1 ) -puts "# array.cr:1617 (063.cr)" # :nocode: :example: +puts "# array.cr:1615 (063.cr)" # :nocode: :example: a = [[:a, :b], [:c, :d], [:e, :f]] ( a.transpose ).should eq( [[:a, :c, :e], [:b, :d, :f]] ) ( a ).should eq( [[:a, :b], [:c, :d], [:e, :f]] ) -puts "# array.cr:1640 (064.cr)" # :nocode: :example: +puts "# array.cr:1638 (064.cr)" # :nocode: :example: a = ["a", "a", "b", "b", "c"] ( a.uniq ).should eq( ["a", "b", "c"] ) ( a ).should eq( [ "a", "a", "b", "b", "c" ] ) -puts "# array.cr:1652 (065.cr)" # :nocode: :example: +puts "# array.cr:1650 (065.cr)" # :nocode: :example: a = [{"student", "sam"}, {"student", "george"}, {"teacher", "matz"}] ( a.uniq { |s| s[0] } ).should eq( [{"student", "sam"}, {"teacher", "matz"}] ) ( a ).should eq( [{"student", "sam"}, {"student", "george"}, {"teacher", "matz"}] ) -puts "# array.cr:1668 (066.cr)" # :nocode: :example: +puts "# array.cr:1666 (066.cr)" # :nocode: :example: a = ["a", "a", "b", "b", "c"] ( a.uniq! ).should eq( ["a", "b", "c"] ) ( a ).should eq( ["a", "b", "c"] ) -puts "# array.cr:1679 (067.cr)" # :nocode: :example: +puts "# array.cr:1677 (067.cr)" # :nocode: :example: a = [{"student", "sam"}, {"student", "george"}, {"teacher", "matz"}] ( a.uniq! { |s| s[0] } ).should eq( [{"student", "sam"}, {"teacher", "matz"}] ) ( a ).should eq( [{"student", "sam"}, {"teacher", "matz"}] ) -puts "# array.cr:1715 (068.cr)" # :nocode: :example: +puts "# array.cr:1713 (068.cr)" # :nocode: :example: a = ["a", "b"] ( a.unshift("c") ).should eq( ["c", "a", "b"] ) # a.unshift(1) # Errors, because the array only accepts String. diff --git a/gen/spec/enum_spec.cr b/gen/spec/enum_spec.cr index bf7cd355..450dbc15 100644 --- a/gen/spec/enum_spec.cr +++ b/gen/spec/enum_spec.cr @@ -22,10 +22,10 @@ enum IOMode end puts "# enum.cr:46 (005.cr)" # :nocode: :example: -( Color.new(1) ).to_s.should eq( "Green" ) +( Color.new(1).to_s ).to_s.should eq( "Green" ) puts "# enum.cr:53 (006.cr)" # :nocode: :example: -( Color.new(10) ).to_s.should eq( "10" ) +( Color.new(10).to_s ).to_s.should eq( "10" ) puts "# enum.cr:65 (007.cr)" # :nocode: :example: color = Color::Blue @@ -79,61 +79,61 @@ puts "# enum.cr:228 (015.cr)" # :nocode: :example: ( Color::Blue <=> Color::Red ).should eq( 1 ) ( Color::Blue <=> Color::Blue ).should eq( 0 ) -puts "# enum.cr:241 (016.cr)" # :nocode: :example: +puts "# enum.cr:246 (016.cr)" # :nocode: :example: # pending by 'file:pendings/enum/016.cr' # :pending: # (member & value) != 0 -puts "# enum.cr:247 (017.cr)" # :nocode: :example: +puts "# enum.cr:252 (017.cr)" # :nocode: :example: # pending by 'file:pendings/enum/017.cr' # :pending: # member.includes?(value) -puts "# enum.cr:255 (018.cr)" # :nocode: :example: +puts "# enum.cr:260 (018.cr)" # :nocode: :example: mode = IOMode::Read | IOMode::Write ( mode.includes?(IOMode::Read) ).should eq( true ) ( mode.includes?(IOMode::Async) ).should eq( false ) -puts "# enum.cr:266 (019.cr)" # :nocode: :example: +puts "# enum.cr:271 (019.cr)" # :nocode: :example: ( Color::Red == Color::Red ).should eq( true ) ( Color::Red == Color::Blue ).should eq( false ) -puts "# enum.cr:281 (020.cr)" # :nocode: :example: +puts "# enum.cr:286 (020.cr)" # :nocode: :example: (IOMode::Read | IOMode::Async).each do |member, value| # yield IOMode::Read, 1 # yield IOMode::Async, 3 end -puts "# enum.cr:304 (021.cr)" # :nocode: :example: +puts "# enum.cr:309 (021.cr)" # :nocode: :example: ( Color.names ).should eq( ["Red", "Green", "Blue"] ) -puts "# enum.cr:317 (022.cr)" # :nocode: :example: +puts "# enum.cr:322 (022.cr)" # :nocode: :example: ( Color.values ).should eq( [Color::Red, Color::Green, Color::Blue] ) -puts "# enum.cr:331 (023.cr)" # :nocode: :example: +puts "# enum.cr:336 (023.cr)" # :nocode: :example: ( Color.from_value?(0) ).should eq( Color::Red ) ( Color.from_value?(1) ).should eq( Color::Green ) ( Color.from_value?(2) ).should eq( Color::Blue ) ( Color.from_value?(3) ).should eq( nil ) -puts "# enum.cr:355 (024.cr)" # :nocode: :example: +puts "# enum.cr:360 (024.cr)" # :nocode: :example: ( Color.from_value(0) ).should eq( Color::Red ) ( Color.from_value(1) ).should eq( Color::Green ) ( Color.from_value(2) ).should eq( Color::Blue ) expect_raises(Exception) { Color.from_value(3) } -puts "# enum.cr:380 (025.cr)" # :nocode: :example: +puts "# enum.cr:385 (025.cr)" # :nocode: :example: ( Color.parse("Red") ).should eq( Color::Red ) ( Color.parse("BLUE") ).should eq( Color::Blue ) expect_raises(ArgumentError) { Color.parse("Yellow") } -puts "# enum.cr:396 (026.cr)" # :nocode: :example: +puts "# enum.cr:401 (026.cr)" # :nocode: :example: ( Color.parse?("Red") ).should eq( Color::Red ) ( Color.parse?("BLUE") ).should eq( Color::Blue ) ( Color.parse?("Yellow") ).should eq( nil ) -puts "# enum.cr:420 (027.cr)" # :nocode: :example: +puts "# enum.cr:425 (027.cr)" # :nocode: :example: ( IOMode.flags(Read, Write) ).should eq( IOMode::Read | IOMode::Write ) -puts "# enum.cr:432 (028.cr)" # :nocode: :example: +puts "# enum.cr:437 (028.cr)" # :nocode: :example: IOMode.each do |member, value| # yield IOMode::Read, 1 # yield IOMode::Write, 2 diff --git a/gen/spec/hash_spec.cr b/gen/spec/hash_spec.cr index a7cf397c..8b8e66d7 100644 --- a/gen/spec/hash_spec.cr +++ b/gen/spec/hash_spec.cr @@ -98,20 +98,20 @@ h.each do |key_and_value| ( key_and_value ).should eq( {"foo", "bar"} ) end -puts "# hash.cr:305 (016.cr)" # :nocode: :example: +puts "# hash.cr:304 (016.cr)" # :nocode: :example: hsh = {"foo" => "bar", "baz" => "qux"} iterator = hsh.each ( iterator.next ).should eq( {"foo", "bar"} ) ( iterator.next ).should eq( {"baz", "qux"} ) -puts "# hash.cr:318 (017.cr)" # :nocode: :example: +puts "# hash.cr:317 (017.cr)" # :nocode: :example: h = {"foo" => "bar"} h.each_key do |key| ( key ).to_s.should eq( "foo" ) end -puts "# hash.cr:333 (018.cr)" # :nocode: :example: +puts "# hash.cr:332 (018.cr)" # :nocode: :example: hsh = {"foo" => "bar", "baz" => "qux"} iterator = hsh.each_key @@ -121,13 +121,13 @@ key = iterator.next key = iterator.next ( key ).to_s.should eq( "baz" ) -puts "# hash.cr:349 (019.cr)" # :nocode: :example: +puts "# hash.cr:348 (019.cr)" # :nocode: :example: h = {"foo" => "bar"} h.each_value do |value| ( value ).to_s.should eq( "bar" ) end -puts "# hash.cr:364 (020.cr)" # :nocode: :example: +puts "# hash.cr:363 (020.cr)" # :nocode: :example: hsh = {"foo" => "bar", "baz" => "qux"} iterator = hsh.each_value @@ -137,75 +137,75 @@ value = iterator.next value = iterator.next ( value ).to_s.should eq( "qux" ) -puts "# hash.cr:380 (021.cr)" # :nocode: :example: +puts "# hash.cr:379 (021.cr)" # :nocode: :example: h = {"foo" => "bar", "baz" => "bar"} ( h.keys ).should eq( ["foo", "baz"] ) -puts "# hash.cr:392 (022.cr)" # :nocode: :example: +puts "# hash.cr:391 (022.cr)" # :nocode: :example: h = {"foo" => "bar", "baz" => "qux"} ( h.values ).should eq( ["bar", "qux"] ) -puts "# hash.cr:405 (023.cr)" # :nocode: :example: +puts "# hash.cr:404 (023.cr)" # :nocode: :example: h = {"foo" => "bar", "baz" => "qux"} ( h.key_index("foo") ).should eq( 0 ) ( h.key_index("qux") ).should eq( nil ) -puts "# hash.cr:420 (024.cr)" # :nocode: :example: +puts "# hash.cr:419 (024.cr)" # :nocode: :example: hash = {"foo" => "bar"} hash.merge({"baz" => "qux"}) # => {"foo" => "bar", "baz" => "qux"} hash # => {"foo" => "bar"} -puts "# hash.cr:443 (025.cr)" # :nocode: :example: +puts "# hash.cr:442 (025.cr)" # :nocode: :example: hash = {"foo" => "bar"} hash.merge!({"baz" => "qux"}) ( hash ).should eq( {"foo" => "bar", "baz" => "qux"} ) -puts "# hash.cr:467 (026.cr)" # :nocode: :example: +puts "# hash.cr:466 (026.cr)" # :nocode: :example: h = {"a" => 100, "b" => 200, "c" => 300} ( h.select { |k, v| k > "a" } ).should eq( {"b" => 200, "c" => 300} ) ( h.select { |k, v| v < 200 } ).should eq( {"a" => 100} ) -puts "# hash.cr:482 (027.cr)" # :nocode: :example: +puts "# hash.cr:481 (027.cr)" # :nocode: :example: h = {"a" => 100, "b" => 200, "c" => 300} ( h.reject { |k, v| k > "a" } ).should eq( {"a" => 100} ) ( h.reject { |k, v| v < 200 } ).should eq( {"b" => 200, "c" => 300} ) -puts "# hash.cr:504 (028.cr)" # :nocode: :example: +puts "# hash.cr:503 (028.cr)" # :nocode: :example: ( {"a" => 1, "b" => 2, "c" => 3, "d" => 4}.reject("a", "c") ).should eq( {"b" => 2, "d" => 4} ) -puts "# hash.cr:514 (029.cr)" # :nocode: :example: +puts "# hash.cr:513 (029.cr)" # :nocode: :example: h = {"a" => 1, "b" => 2, "c" => 3, "d" => 4}.reject!("a", "c") ( h ).should eq( {"b" => 2, "d" => 4} ) -puts "# hash.cr:529 (030.cr)" # :nocode: :example: +puts "# hash.cr:528 (030.cr)" # :nocode: :example: ( {"a" => 1, "b" => 2, "c" => 3, "d" => 4}.select("a", "c") ).should eq( {"a" => 1, "c" => 3} ) -puts "# hash.cr:544 (031.cr)" # :nocode: :example: +puts "# hash.cr:543 (031.cr)" # :nocode: :example: h = {"a" => 1, "b" => 2, "c" => 3, "d" => 4}.select!("a", "c") ( h ).should eq( {"a" => 1, "c" => 3} ) -puts "# hash.cr:559 (032.cr)" # :nocode: :example: +puts "# hash.cr:558 (032.cr)" # :nocode: :example: hash = {"hello" => "world", "foo" => nil} ( hash.compact ).should eq( {"hello" => "world"} ) -puts "# hash.cr:571 (033.cr)" # :nocode: :example: +puts "# hash.cr:570 (033.cr)" # :nocode: :example: hash = {"hello" => "world", "foo" => nil} ( hash.compact! ).should eq( {"hello" => "world"} ) ( hash.compact! ).should eq( nil ) -puts "# hash.cr:582 (034.cr)" # :nocode: :example: +puts "# hash.cr:581 (034.cr)" # :nocode: :example: Hash.zip(["key1", "key2", "key3"], ["value1", "value2", "value3"]) # => {"key1" => "value1", "key2" => "value2", "key3" => "value3"} -puts "# hash.cr:601 (035.cr)" # :nocode: :example: +puts "# hash.cr:600 (035.cr)" # :nocode: :example: hash = {"foo" => "bar"} ( hash.first_key? ).to_s.should eq( "foo" ) hash.clear ( hash.first_key? ).should eq( nil ) -puts "# hash.cr:624 (036.cr)" # :nocode: :example: +puts "# hash.cr:623 (036.cr)" # :nocode: :example: hash = {"foo" => "bar", "baz" => "qux"} ( hash.shift ).should eq( {"foo", "bar"} ) ( hash ).should eq( {"baz" => "qux"} ) @@ -213,7 +213,7 @@ hash = {"foo" => "bar", "baz" => "qux"} hash = {} of String => String expect_raises(IndexError) { hash.shift } -puts "# hash.cr:638 (037.cr)" # :nocode: :example: +puts "# hash.cr:637 (037.cr)" # :nocode: :example: hash = {"foo" => "bar", "baz" => "qux"} ( hash.shift? ).should eq( {"foo", "bar"} ) ( hash ).should eq( {"baz" => "qux"} ) @@ -221,7 +221,7 @@ hash = {"foo" => "bar", "baz" => "qux"} hash = {} of String => String ( hash.shift? ).should eq( nil ) -puts "# hash.cr:653 (038.cr)" # :nocode: :example: +puts "# hash.cr:652 (038.cr)" # :nocode: :example: hash = {"foo" => "bar", "baz" => "qux"} ( hash.shift { true } ).should eq( {"foo", "bar"} ) ( hash ).should eq( {"baz" => "qux"} ) @@ -230,32 +230,32 @@ hash = {} of String => String ( hash.shift { true } ).should eq( true ) ( hash ).to_s.should eq( "{}" ) -puts "# hash.cr:674 (039.cr)" # :nocode: :example: +puts "# hash.cr:673 (039.cr)" # :nocode: :example: hash = {"foo" => "bar"} ( hash.clear ).to_s.should eq( "{}" ) -puts "# hash.cr:700 (040.cr)" # :nocode: :example: +puts "# hash.cr:699 (040.cr)" # :nocode: :example: foo = {"foo" => "bar"} foo.hash # => 3247054 -puts "# hash.cr:714 (041.cr)" # :nocode: :example: +puts "# hash.cr:713 (041.cr)" # :nocode: :example: hash_a = {"foo" => "bar"} hash_b = hash_a.dup hash_b.merge!({"baz" => "qux"}) ( hash_a ).should eq( {"foo" => "bar"} ) -puts "# hash.cr:730 (042.cr)" # :nocode: :example: +puts "# hash.cr:729 (042.cr)" # :nocode: :example: hash_a = {"foobar" => {"foo" => "bar"}} hash_b = hash_a.clone hash_b["foobar"]["foo"] = "baz" ( hash_a ).should eq( {"foobar" => {"foo" => "bar"}} ) -puts "# hash.cr:750 (043.cr)" # :nocode: :example: +puts "# hash.cr:749 (043.cr)" # :nocode: :example: h = {"foo" => "bar"} ( h.to_s ).to_s.should eq( "{\"foo\" => \"bar\"}" ) ( h.to_s.class ).should eq( String ) -puts "# hash.cr:808 (044.cr)" # :nocode: :example: +puts "# hash.cr:807 (044.cr)" # :nocode: :example: ( {"foo" => "bar"}.invert ).should eq( {"bar" => "foo"} ) ( {"foo" => "bar", "baz" => "bar"}.invert ).should eq( {"bar" => "baz"} ) diff --git a/gen/spec/html_spec.cr b/gen/spec/html_spec.cr index 43f670cf..86d0f7d1 100644 --- a/gen/spec/html_spec.cr +++ b/gen/spec/html_spec.cr @@ -12,7 +12,7 @@ puts "# html.cr:38 (002.cr)" # :nocode: :example: # require "html" io = IO::Memory.new -( HTML.escape("Crystal & You", io) ).to_s.should eq( "Crystal & You" ) +( HTML.escape("Crystal & You", io) ).should eq( nil ) ( io.to_s ).to_s.should eq( "Crystal & You" ) puts "# html.cr:53 (003.cr)" # :nocode: :example: diff --git a/gen/spec/http/headers_spec.cr b/gen/spec/http/headers_spec.cr index 8ecbab1a..439d4029 100644 --- a/gen/spec/http/headers_spec.cr +++ b/gen/spec/http/headers_spec.cr @@ -3,7 +3,7 @@ require "http/headers" it "http/headers.cr" do puts # :nocode: -puts "# http/headers.cr:77 (001.cr)" # :nocode: :example: +puts "# http/headers.cr:79 (001.cr)" # :nocode: :example: headers = HTTP::Headers{"Connection" => "keep-alive, Upgrade"} ( headers.includes_word?("Connection", "Upgrade") ).should eq( true ) diff --git a/gen/spec/indexable_spec.cr b/gen/spec/indexable_spec.cr index 189b4c6a..06168655 100644 --- a/gen/spec/indexable_spec.cr +++ b/gen/spec/indexable_spec.cr @@ -55,67 +55,67 @@ puts "# indexable.cr:171 (009.cr)" # :nocode: :example: a = ["a", "b", "c"] a.each_index { |x| print x, " -- " } -puts "# indexable.cr:192 (010.cr)" # :nocode: :example: +puts "# indexable.cr:191 (010.cr)" # :nocode: :example: a = ["a", "b", "c"] iter = a.each_index ( iter.next ).should eq( 0 ) ( iter.next ).should eq( 1 ) -puts "# indexable.cr:207 (011.cr)" # :nocode: :example: +puts "# indexable.cr:206 (011.cr)" # :nocode: :example: ( ([] of Int32).empty? ).should eq( true ) ( ([1]).empty? ).should eq( false ) -puts "# indexable.cr:222 (012.cr)" # :nocode: :example: +puts "# indexable.cr:221 (012.cr)" # :nocode: :example: a = [1, 2, 3] b = ["a", "ab", "abc"] ( a.equals?(b) { |x, y| x == y.size } ).should eq( true ) ( a.equals?(b) { |x, y| x == y } ).should eq( false ) -puts "# indexable.cr:238 (013.cr)" # :nocode: :example: +puts "# indexable.cr:237 (013.cr)" # :nocode: :example: ( ([1, 2, 3]).first ).should eq( 1 ) expect_raises(IndexError) { ([] of Int32).first } -puts "# indexable.cr:248 (014.cr)" # :nocode: :example: +puts "# indexable.cr:247 (014.cr)" # :nocode: :example: ( ([1, 2, 3]).first { 4 } ).should eq( 1 ) ( ([] of Int32).first { 4 } ).should eq( 4 ) -puts "# indexable.cr:258 (015.cr)" # :nocode: :example: +puts "# indexable.cr:257 (015.cr)" # :nocode: :example: ( ([1, 2, 3]).first? ).should eq( 1 ) ( ([] of Int32).first? ).should eq( nil ) -puts "# indexable.cr:278 (016.cr)" # :nocode: :example: +puts "# indexable.cr:277 (016.cr)" # :nocode: :example: ( [1, 2, 3, 1, 2, 3].index(2, offset: 2) ).should eq( 4 ) -puts "# indexable.cr:289 (017.cr)" # :nocode: :example: +puts "# indexable.cr:288 (017.cr)" # :nocode: :example: ( [1, 2, 3, 1, 2, 3].index(offset: 2) { |x| x < 2 } ).should eq( 3 ) -puts "# indexable.cr:306 (018.cr)" # :nocode: :example: +puts "# indexable.cr:305 (018.cr)" # :nocode: :example: ( ([1, 2, 3]).last ).should eq( 3 ) expect_raises(IndexError) { ([] of Int32).last } -puts "# indexable.cr:316 (019.cr)" # :nocode: :example: +puts "# indexable.cr:315 (019.cr)" # :nocode: :example: ( ([1, 2, 3]).last { 4 } ).should eq( 3 ) ( ([] of Int32).last { 4 } ).should eq( 4 ) -puts "# indexable.cr:326 (020.cr)" # :nocode: :example: +puts "# indexable.cr:325 (020.cr)" # :nocode: :example: ( ([1, 2, 3]).last? ).should eq( 3 ) ( ([] of Int32).last? ).should eq( nil ) -puts "# indexable.cr:353 (021.cr)" # :nocode: :example: +puts "# indexable.cr:351 (021.cr)" # :nocode: :example: ( [1, 2, 3, 2, 3].rindex(2) ).should eq( 3 ) ( [1, 2, 3, 2, 3].rindex(2, offset: 2) ).should eq( 1 ) -puts "# indexable.cr:368 (022.cr)" # :nocode: :example: +puts "# indexable.cr:366 (022.cr)" # :nocode: :example: ( [1, 2, 3, 2, 3].rindex { |x| x < 3 } ).should eq( 3 ) ( [1, 2, 3, 2, 3].rindex(offset: 2) { |x| x < 3 } ).should eq( 1 ) -puts "# indexable.cr:387 (023.cr)" # :nocode: :example: +puts "# indexable.cr:385 (023.cr)" # :nocode: :example: a = [1, 2, 3] a.sample # => 2 a.sample # => 1 a.sample(Random.new(1)) # => 3 -puts "# indexable.cr:401 (024.cr)" # :nocode: :example: +puts "# indexable.cr:399 (024.cr)" # :nocode: :example: ( ["a", "b", "c", "d"].values_at(0, 2) ).should eq( {"a", "c"} ) diff --git a/gen/spec/int_spec.cr b/gen/spec/int_spec.cr index 4ef00ad7..13211674 100644 --- a/gen/spec/int_spec.cr +++ b/gen/spec/int_spec.cr @@ -69,7 +69,7 @@ puts "# int.cr:288 (011.cr)" # :nocode: :example: ( 11.bit(3) ).should eq( 1 ) ( 11.bit(4) ).should eq( 0 ) -puts "# int.cr:476 (012.cr)" # :nocode: :example: +puts "# int.cr:472 (012.cr)" # :nocode: :example: ( 5.popcount ).should eq( 2 ) ( -15.popcount ).should eq( 29 ) diff --git a/gen/spec/kernel_spec.cr b/gen/spec/kernel_spec.cr index a9f431da..34a089af 100644 --- a/gen/spec/kernel_spec.cr +++ b/gen/spec/kernel_spec.cr @@ -8,10 +8,10 @@ loop do |i| # ... end -puts "# kernel.cr:110 (002.cr)" # :nocode: :example: +puts "# kernel.cr:109 (002.cr)" # :nocode: :example: ( p foo: 23, bar: 42 ).should eq( {foo: 23, bar: 42} ) -puts "# kernel.cr:145 (003.cr)" # :nocode: :example: +puts "# kernel.cr:144 (003.cr)" # :nocode: :example: def do_at_exit(str1) at_exit { print str1 } end diff --git a/gen/spec/named_tuple_spec.cr b/gen/spec/named_tuple_spec.cr index f9196625..7ba68b0b 100644 --- a/gen/spec/named_tuple_spec.cr +++ b/gen/spec/named_tuple_spec.cr @@ -91,45 +91,45 @@ tuple.each do |key, value| puts "#{key} = #{value}" end -puts "# named_tuple.cr:302 (015.cr)" # :nocode: :example: +puts "# named_tuple.cr:301 (015.cr)" # :nocode: :example: tuple = {name: "Crystal", year: 2011} tuple.each_key do |key| puts key end -puts "# named_tuple.cr:324 (016.cr)" # :nocode: :example: +puts "# named_tuple.cr:322 (016.cr)" # :nocode: :example: tuple = {name: "Crystal", year: 2011} tuple.each_value do |value| puts value end -puts "# named_tuple.cr:346 (017.cr)" # :nocode: :example: +puts "# named_tuple.cr:343 (017.cr)" # :nocode: :example: tuple = {name: "Crystal", year: 2011} tuple.each_with_index do |key, value, i| puts "#{i + 1}) #{key} = #{value}" end -puts "# named_tuple.cr:371 (018.cr)" # :nocode: :example: +puts "# named_tuple.cr:367 (018.cr)" # :nocode: :example: tuple = {name: "Crystal", year: 2011} ( tuple.map { |k, v| "#{k}: #{v}" } ).should eq( ["name: Crystal", "year: 2011"] ) -puts "# named_tuple.cr:385 (019.cr)" # :nocode: :example: +puts "# named_tuple.cr:381 (019.cr)" # :nocode: :example: tuple = {name: "Crystal", year: 2011} ( tuple.to_a ).should eq( [{:name, "Crystal"}, {:year, 2011}] ) -puts "# named_tuple.cr:399 (020.cr)" # :nocode: :example: +puts "# named_tuple.cr:395 (020.cr)" # :nocode: :example: tuple = {name: "Crystal", year: 2011} ( tuple.to_h ).should eq( {:name => "Crystal", :year => 2011} ) -puts "# named_tuple.cr:415 (021.cr)" # :nocode: :example: +puts "# named_tuple.cr:411 (021.cr)" # :nocode: :example: tuple = {name: "Crystal", year: 2011} ( tuple.size ).should eq( 2 ) -puts "# named_tuple.cr:425 (022.cr)" # :nocode: :example: +puts "# named_tuple.cr:421 (022.cr)" # :nocode: :example: tuple = {name: "Crystal", year: 2011} ( tuple.empty? ).should eq( false ) -puts "# named_tuple.cr:436 (023.cr)" # :nocode: :example: +puts "# named_tuple.cr:432 (023.cr)" # :nocode: :example: tuple1 = {name: "Crystal", year: 2011} tuple2 = {year: 2011, name: "Crystal"} tuple3 = {name: "Crystal", year: 2012} diff --git a/gen/spec/nil_spec.cr b/gen/spec/nil_spec.cr index 0babda32..263af866 100644 --- a/gen/spec/nil_spec.cr +++ b/gen/spec/nil_spec.cr @@ -26,7 +26,7 @@ if idx2 end # Tell the compiler that we are sure the returned -# value is not nil: raises a runtime exception +# # value is not nil: raises a runtime exception # if our assumption doesn't hold. idx3 = str.index('o').not_nil! diff --git a/gen/spec/pointer_spec.cr b/gen/spec/pointer_spec.cr index 9373916c..7eb7a15d 100644 --- a/gen/spec/pointer_spec.cr +++ b/gen/spec/pointer_spec.cr @@ -7,7 +7,7 @@ puts "# pointer.cr:17 (001.cr)" # :nocode: :example: x = 1 ptr = pointerof(x) ptr.value = 2 -( x ).to_s.should eq( "2" ) +( x ).should eq( 2 ) puts "# pointer.cr:59 (002.cr)" # :nocode: :example: a = 1 diff --git a/gen/spec/range_spec.cr b/gen/spec/range_spec.cr index 8ef4c1cc..823e29e6 100644 --- a/gen/spec/range_spec.cr +++ b/gen/spec/range_spec.cr @@ -58,30 +58,30 @@ puts "# range.cr:97 (008.cr)" # :nocode: :example: (10..15).each { |n| print n, ' ' } # prints: 10 11 12 13 14 15 -puts "# range.cr:113 (009.cr)" # :nocode: :example: +puts "# range.cr:112 (009.cr)" # :nocode: :example: ( (1..3).each.skip(1).to_a ).should eq( [2, 3] ) -puts "# range.cr:122 (010.cr)" # :nocode: :example: +puts "# range.cr:121 (010.cr)" # :nocode: :example: (10...15).reverse_each { |n| print n, ' ' } # prints: 14 13 12 11 10 -puts "# range.cr:138 (011.cr)" # :nocode: :example: +puts "# range.cr:136 (011.cr)" # :nocode: :example: ( (1..3).reverse_each.skip(1).to_a ).should eq( [2, 1] ) -puts "# range.cr:147 (012.cr)" # :nocode: :example: +puts "# range.cr:145 (012.cr)" # :nocode: :example: range = Xs.new(1)..Xs.new(10) range.step(2) { |x| puts x } puts range.step(3) { |x| puts x } -puts "# range.cr:182 (013.cr)" # :nocode: :example: +puts "# range.cr:180 (013.cr)" # :nocode: :example: ( (1..10).step(3).skip(1).to_a ).should eq( [4, 7, 10] ) -puts "# range.cr:191 (014.cr)" # :nocode: :example: +puts "# range.cr:189 (014.cr)" # :nocode: :example: ( (1..10).excludes_end? ).should eq( false ) ( (1...10).excludes_end? ).should eq( true ) -puts "# range.cr:201 (015.cr)" # :nocode: :example: +puts "# range.cr:199 (015.cr)" # :nocode: :example: ( (1..10).includes?(4) ).should eq( true ) ( (1..10).includes?(10) ).should eq( true ) ( (1..10).includes?(11) ).should eq( false ) @@ -89,7 +89,7 @@ puts "# range.cr:201 (015.cr)" # :nocode: :example: ( (1...10).includes?(9) ).should eq( true ) ( (1...10).includes?(10) ).should eq( false ) -puts "# range.cr:224 (016.cr)" # :nocode: :example: +puts "# range.cr:222 (016.cr)" # :nocode: :example: case 79 when 1..50 then puts "low" when 51..75 then puts "medium" diff --git a/gen/spec/set_spec.cr b/gen/spec/set_spec.cr index 2c6e6041..f6f2391a 100644 --- a/gen/spec/set_spec.cr +++ b/gen/spec/set_spec.cr @@ -61,57 +61,57 @@ s = Set(Int32).new s << 3 ( s.empty? ).should eq( false ) -puts "# set.cr:157 (011.cr)" # :nocode: :example: +puts "# set.cr:156 (011.cr)" # :nocode: :example: ( Set{1, 1, 3, 5} & Set{1, 2, 3} ).should eq( Set{1, 3} ) ( Set{'a', 'b', 'b', 'z'} & Set{'a', 'b', 'c'} ).should eq( Set{'a', 'b'} ) -puts "# set.cr:171 (012.cr)" # :nocode: :example: +puts "# set.cr:170 (012.cr)" # :nocode: :example: ( Set{1, 1, 3, 5} | Set{1, 2, 3} ).should eq( Set{1, 3, 5, 2} ) ( Set{'a', 'b', 'b', 'z'} | Set{'a', 'b', 'c'} ).should eq( Set{'a', 'b', 'z', 'c'} ) -puts "# set.cr:187 (013.cr)" # :nocode: :example: +puts "# set.cr:186 (013.cr)" # :nocode: :example: ( Set{1, 2, 3, 4, 5} - Set{2, 4} ).should eq( Set{1, 3, 5} ) ( Set{'a', 'b', 'b', 'z'} - Set{'a', 'b', 'c'} ).should eq( Set{'z'} ) -puts "# set.cr:202 (014.cr)" # :nocode: :example: +puts "# set.cr:201 (014.cr)" # :nocode: :example: ( Set{1, 2, 3, 4, 5} - [2, 4] ).should eq( Set{1, 3, 5} ) ( Set{'a', 'b', 'b', 'z'} - ['a', 'b', 'c'] ).should eq( Set{'z'} ) -puts "# set.cr:213 (015.cr)" # :nocode: :example: +puts "# set.cr:212 (015.cr)" # :nocode: :example: ( Set{1, 2, 3, 4, 5} ^ Set{2, 4, 6} ).should eq( Set{1, 3, 5, 6} ) ( Set{'a', 'b', 'b', 'z'} ^ Set{'a', 'b', 'c'} ).should eq( Set{'z', 'c'} ) -puts "# set.cr:231 (016.cr)" # :nocode: :example: +puts "# set.cr:230 (016.cr)" # :nocode: :example: ( Set{1, 2, 3, 4, 5} ^ [2, 4, 6] ).should eq( Set{1, 3, 5, 6} ) ( Set{'a', 'b', 'b', 'z'} ^ ['a', 'b', 'c'] ).should eq( Set{'z', 'c'} ) -puts "# set.cr:250 (017.cr)" # :nocode: :example: +puts "# set.cr:249 (017.cr)" # :nocode: :example: ( Set{'a', 'b', 'b', 'z'}.subtract Set{'a', 'b', 'c'} ).should eq( Set{'z'} ) ( Set{1, 2, 3, 4, 5}.subtract [2, 4, 6] ).should eq( Set{1, 3, 5} ) -puts "# set.cr:263 (018.cr)" # :nocode: :example: +puts "# set.cr:262 (018.cr)" # :nocode: :example: ( Set{1, 5} == Set{1, 5} ).should eq( true ) -puts "# set.cr:286 (019.cr)" # :nocode: :example: +puts "# set.cr:285 (019.cr)" # :nocode: :example: ( Set{1, 5}.to_a ).should eq( [1,5] ) -puts "# set.cr:309 (020.cr)" # :nocode: :example: +puts "# set.cr:308 (020.cr)" # :nocode: :example: ( Set{1, 2, 3}.intersects? Set{4, 5} ).should eq( false ) ( Set{1, 2, 3}.intersects? Set{3, 4} ).should eq( true ) -puts "# set.cr:333 (021.cr)" # :nocode: :example: +puts "# set.cr:332 (021.cr)" # :nocode: :example: ( Set{1, 5}.subset? Set{1, 3, 5} ).should eq( true ) ( Set{1, 3, 5}.subset? Set{1, 3, 5} ).should eq( true ) -puts "# set.cr:347 (022.cr)" # :nocode: :example: +puts "# set.cr:346 (022.cr)" # :nocode: :example: ( Set{1, 5}.proper_subset? Set{1, 3, 5} ).should eq( true ) ( Set{1, 3, 5}.proper_subset? Set{1, 3, 5} ).should eq( false ) -puts "# set.cr:361 (023.cr)" # :nocode: :example: +puts "# set.cr:360 (023.cr)" # :nocode: :example: ( Set{1, 3, 5}.superset? Set{1, 5} ).should eq( true ) ( Set{1, 3, 5}.superset? Set{1, 3, 5} ).should eq( true ) -puts "# set.cr:374 (024.cr)" # :nocode: :example: +puts "# set.cr:373 (024.cr)" # :nocode: :example: ( Set{1, 3, 5}.proper_superset? Set{1, 5} ).should eq( true ) ( Set{1, 3, 5}.proper_superset? Set{1, 3, 5} ).should eq( false ) diff --git a/gen/spec/static_array_spec.cr b/gen/spec/static_array_spec.cr index cf3191b4..5373834e 100644 --- a/gen/spec/static_array_spec.cr +++ b/gen/spec/static_array_spec.cr @@ -44,7 +44,7 @@ array = StaticArray(Int32, 3).new { |i| i + 1 } puts "# static_array.cr:131 (009.cr)" # :nocode: :example: array = StaticArray(Int32, 3).new { |i| i + 1 } -( array.[]= 2 ).should eq( 3 ) +( array.[]= 2 ).should eq( nil ) ( array ).should eq( StaticArray[2, 2, 2] ) puts "# static_array.cr:145 (010.cr)" # :nocode: :example: diff --git a/gen/spec/string_spec.cr b/gen/spec/string_spec.cr index d275e891..f9e323d0 100644 --- a/gen/spec/string_spec.cr +++ b/gen/spec/string_spec.cr @@ -134,14 +134,14 @@ puts "# string.cr:601 (021.cr)" # :nocode: :example: expect_raises(ArgumentError) { "45.67 degrees".to_f } expect_raises(ArgumentError) { "thx1138".to_f(strict: false) } expect_raises(ArgumentError) { " 1.2".to_f(whitespace: false) } -( "1.2foo".to_f(strict: false) ).try(&.to_f).to_s.should eq( "1.2" ) +( "1.2foo".to_f(strict: false) ).to_s.should eq( "1.2" ) puts "# string.cr:619 (022.cr)" # :nocode: :example: ( "123.45e1".to_f? ).to_s.should eq( "1234.5" ) ( "45.67 degrees".to_f? ).should eq( nil ) ( "thx1138".to_f? ).should eq( nil ) ( " 1.2".to_f?(whitespace: false) ).should eq( nil ) -( "1.2foo".to_f?(strict: false) ).try(&.to_f).to_s.should eq( "1.2" ) +( "1.2foo".to_f?(strict: false) ).to_s.should eq( "1.2" ) puts "# string.cr:689 (023.cr)" # :nocode: :example: "hello"[0] # 'h' @@ -541,46 +541,46 @@ array = [] of Char end ( array ).should eq( ['a', 'b', '☃'] ) -puts "# string.cr:3172 (103.cr)" # :nocode: :example: +puts "# string.cr:3171 (103.cr)" # :nocode: :example: chars = "ab☃".each_char ( chars.next ).should eq( 'a' ) ( chars.next ).should eq( 'b' ) ( chars.next ).should eq( '☃' ) -puts "# string.cr:3184 (104.cr)" # :nocode: :example: +puts "# string.cr:3183 (104.cr)" # :nocode: :example: array = [] of Tuple(Char, Int32) "ab☃".each_char_with_index do |char, index| array << {char, index} end ( array ).should eq( [{'a', 0}, {'b', 1}, {'☃', 2}] ) -puts "# string.cr:3202 (105.cr)" # :nocode: :example: +puts "# string.cr:3200 (105.cr)" # :nocode: :example: ( "ab☃".chars ).should eq( ['a', 'b', '☃'] ) -puts "# string.cr:3215 (106.cr)" # :nocode: :example: +puts "# string.cr:3213 (106.cr)" # :nocode: :example: array = [] of Int32 "ab☃".each_codepoint do |codepoint| array << codepoint end ( array ).should eq( [97, 98, 9731] ) -puts "# string.cr:3232 (107.cr)" # :nocode: :example: +puts "# string.cr:3230 (107.cr)" # :nocode: :example: codepoints = "ab☃".each_codepoint ( codepoints.next ).should eq( 97 ) ( codepoints.next ).should eq( 98 ) ( codepoints.next ).should eq( 9731 ) -puts "# string.cr:3246 (108.cr)" # :nocode: :example: +puts "# string.cr:3244 (108.cr)" # :nocode: :example: ( "ab☃".codepoints ).should eq( [97, 98, 9731] ) -puts "# string.cr:3261 (109.cr)" # :nocode: :example: +puts "# string.cr:3259 (109.cr)" # :nocode: :example: array = [] of UInt8 "ab☃".each_byte do |byte| array << byte end ( array ).should eq( [97, 98, 226, 152, 131] ) -puts "# string.cr:3277 (110.cr)" # :nocode: :example: +puts "# string.cr:3275 (110.cr)" # :nocode: :example: bytes = "ab☃".each_byte ( bytes.next ).should eq( 97 ) ( bytes.next ).should eq( 98 ) @@ -588,14 +588,14 @@ bytes = "ab☃".each_byte ( bytes.next ).should eq( 152 ) ( bytes.next ).should eq( 131 ) -puts "# string.cr:3291 (111.cr)" # :nocode: :example: +puts "# string.cr:3289 (111.cr)" # :nocode: :example: ( "hello".bytes ).should eq( [104, 101, 108, 108, 111] ) ( "你好".bytes ).should eq( [228, 189, 160, 229, 165, 189] ) -puts "# string.cr:3441 (112.cr)" # :nocode: :example: +puts "# string.cr:3439 (112.cr)" # :nocode: :example: ( "Party like it's %d!!!" % 1999 ).to_s.should eq( "Party like it's 1999!!!" ) -puts "# string.cr:3461 (113.cr)" # :nocode: :example: +puts "# string.cr:3459 (113.cr)" # :nocode: :example: ( "hello".size ).should eq( 5 ) ( "你好".size ).should eq( 2 ) diff --git a/gen/spec/tuple_spec.cr b/gen/spec/tuple_spec.cr index 4c21ad51..b0199f3f 100644 --- a/gen/spec/tuple_spec.cr +++ b/gen/spec/tuple_spec.cr @@ -85,7 +85,7 @@ tuple.each do |value| puts value end -puts "# tuple.cr:210 (013.cr)" # :nocode: :example: +puts "# tuple.cr:209 (013.cr)" # :nocode: :example: t1 = {1, "hello"} t2 = {1.0, "hello"} t3 = {2, "hello"} @@ -93,67 +93,67 @@ t3 = {2, "hello"} ( t1 == t2 ).should eq( true ) ( t1 == t3 ).should eq( false ) -puts "# tuple.cr:241 (014.cr)" # :nocode: :example: +puts "# tuple.cr:240 (014.cr)" # :nocode: :example: ( {1, 2} === {1, 2} ).should eq( true ) ( {1, 2} === {1, 3} ).should eq( false ) -puts "# tuple.cr:257 (015.cr)" # :nocode: :example: +puts "# tuple.cr:256 (015.cr)" # :nocode: :example: ( {1, 2} === {1, 2, 3} ).should eq( false ) ( {/o+/, "bar"} === {"foo", "bar"} ).should eq( true ) -puts "# tuple.cr:286 (016.cr)" # :nocode: :example: +puts "# tuple.cr:285 (016.cr)" # :nocode: :example: ( {"a", "a", "c"} <=> {"a", "b", "c"} ).should eq( -1 ) ( {1, 2, 3, 4, 5, 6} <=> {1, 2} ).should eq( +1 ) ( {1, 2} <=> {1, 2.0} ).should eq( 0 ) -puts "# tuple.cr:335 (017.cr)" # :nocode: :example: +puts "# tuple.cr:334 (017.cr)" # :nocode: :example: t1 = {1, 2} t2 = {"foo", "bar"} t3 = t1 + t2 ( t3 ).should eq( {1, 2, "foo", "bar"} ) ( typeof(t3) ).should eq( Tuple(Int32, Int32, String, String) ) -puts "# tuple.cr:361 (018.cr)" # :nocode: :example: +puts "# tuple.cr:360 (018.cr)" # :nocode: :example: ( {'a', 'b'}.size ).should eq( 2 ) -puts "# tuple.cr:370 (019.cr)" # :nocode: :example: +puts "# tuple.cr:369 (019.cr)" # :nocode: :example: tuple = {1, "hello", 'x'} ( tuple.types ).should eq( Tuple(Int32, String, Char) ) -puts "# tuple.cr:385 (020.cr)" # :nocode: :example: +puts "# tuple.cr:384 (020.cr)" # :nocode: :example: tuple = {1, "hello"} ( tuple.to_s ).to_s.should eq( "{1, \"hello\"}" ) -puts "# tuple.cr:401 (021.cr)" # :nocode: :example: +puts "# tuple.cr:400 (021.cr)" # :nocode: :example: tuple = {1, 2.5, "a"} ( tuple.map &.to_s ).should eq( {"1", "2.5", "a"} ) -puts "# tuple.cr:417 (022.cr)" # :nocode: :example: +puts "# tuple.cr:416 (022.cr)" # :nocode: :example: tuple = {1, 2.5, "a"} ( tuple.reverse ).should eq( {"a", 2.5, 1} ) -puts "# tuple.cr:433 (023.cr)" # :nocode: :example: +puts "# tuple.cr:432 (023.cr)" # :nocode: :example: tuple = {1, "hello", 'x'} tuple.reverse_each do |value| puts value end -puts "# tuple.cr:457 (024.cr)" # :nocode: :example: +puts "# tuple.cr:456 (024.cr)" # :nocode: :example: tuple = {1, 2.5} ( tuple.first ).should eq( 1 ) -puts "# tuple.cr:467 (025.cr)" # :nocode: :example: +puts "# tuple.cr:466 (025.cr)" # :nocode: :example: tuple = {1, 2.5} ( tuple.first? ).should eq( 1 ) empty = Tuple.new ( empty.first? ).should eq( nil ) -puts "# tuple.cr:485 (026.cr)" # :nocode: :example: +puts "# tuple.cr:484 (026.cr)" # :nocode: :example: tuple = {1, 2.5} ( tuple.last ).try(&.to_f).to_s.should eq( "2.5" ) -puts "# tuple.cr:498 (027.cr)" # :nocode: :example: +puts "# tuple.cr:497 (027.cr)" # :nocode: :example: tuple = {1, 2.5} ( tuple.last? ).try(&.to_f).to_s.should eq( "2.5" ) diff --git a/shard.yml b/shard.yml index 52b10293..d0c73540 100644 --- a/shard.yml +++ b/shard.yml @@ -8,7 +8,7 @@ dependencies: comment-spec: github: maiha/comment-spec.cr - version: 0.2.1 + version: 0.3.0 authors: - maiha diff --git a/src/examples/generator/generator.cr b/src/examples/generator/generator.cr index 4ed8ee19..e0e176c0 100644 --- a/src/examples/generator/generator.cr +++ b/src/examples/generator/generator.cr @@ -65,7 +65,7 @@ class Examples::Generator::Generator end private def build_spec_code(c : Comment) - c.lines.map{|line| CommentSpec.new(line).spec}.join("\n") + c.lines.map{|line| CommentSpec.parse(line)}.join("\n") end private def require_codes diff --git a/src/examples/generator/rules.cr b/src/examples/generator/rules.cr index 6db6a514..6552e52d 100644 --- a/src/examples/generator/rules.cr +++ b/src/examples/generator/rules.cr @@ -1,6 +1,7 @@ module Examples::Generator RULES = [ # white lists + Depend.new("http/formdata/generator.cr", to: "http"), Depend.new("ini.cr"), Depend.new("json/from_json.cr", to: "json"), Depend.new("json/any.cr", to: "json"),