Skip to content

Commit

Permalink
Specs 127 (107 successes, 0 failures, 20 pending)
Browse files Browse the repository at this point in the history
Examples 1195 (1011 successes, 0 failures, 184 pending)
  • Loading branch information
maiha committed Jan 6, 2017
1 parent b8321d8 commit 3be35bd
Show file tree
Hide file tree
Showing 200 changed files with 541 additions and 529 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Expand Up @@ -2,5 +2,6 @@ language: crystal
sudo: false
script:
- make test
- make gen_spec
- make generated_spec
- make status
- make spec_succeeded
17 changes: 13 additions & 4 deletions Makefile
Expand Up @@ -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}
Expand All @@ -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\
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
14 changes: 10 additions & 4 deletions README.md
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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`
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions doc/compile/cache
Expand Up @@ -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
2 changes: 1 addition & 1 deletion doc/compile/log
Expand Up @@ -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)
15 changes: 8 additions & 7 deletions 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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
2 changes: 1 addition & 1 deletion doc/spec/example_cnt_ng
@@ -1 +1 @@
16
0
2 changes: 1 addition & 1 deletion doc/spec/example_cnt_ok
@@ -1 +1 @@
996
1011
2 changes: 1 addition & 1 deletion doc/spec/example_cnt_ok_all
@@ -1 +1 @@
1022
1038
2 changes: 1 addition & 1 deletion doc/spec/example_cnt_ok_pending
@@ -1 +1 @@
26
27
2 changes: 1 addition & 1 deletion doc/spec/example_cnt_pending
@@ -1 +1 @@
183
184
31 changes: 15 additions & 16 deletions doc/spec/fixtures
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"]
Expand All @@ -1041,13 +1047,20 @@ 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
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'
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
14 changes: 1 addition & 13 deletions doc/spec/log
Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion doc/spec/ng
@@ -1 +0,0 @@
gen/spec/range_spec.cr
1 change: 1 addition & 0 deletions doc/spec/ok
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/array/007.cr
Expand Up @@ -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]]
4 changes: 2 additions & 2 deletions examples/array/008.cr
Expand Up @@ -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]]
8 changes: 4 additions & 4 deletions examples/array/026.cr
Expand Up @@ -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]]
8 changes: 4 additions & 4 deletions examples/array/034.cr
Expand Up @@ -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]]
2 changes: 1 addition & 1 deletion 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]
2 changes: 1 addition & 1 deletion examples/array/051.cr
@@ -1,4 +1,4 @@
# array.cr:1246
# array.cr:1244
a = ["a", "b", "c"]
a.pop # => "c"
a # => ["a", "b"]
2 changes: 1 addition & 1 deletion examples/array/052.cr
@@ -1,4 +1,4 @@
# array.cr:1258
# array.cr:1256
a = [1]
a.pop { "Testing" } # => 1
a.pop { "Testing" } # => "Testing"
2 changes: 1 addition & 1 deletion 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"]
Expand Down
2 changes: 1 addition & 1 deletion 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.
Expand Down
2 changes: 1 addition & 1 deletion examples/array/055.cr
@@ -1,3 +1,3 @@
# array.cr:1344
# array.cr:1342
a = ["a"]
a.push("b", "c") # => ["a", "b", "c"]
2 changes: 1 addition & 1 deletion examples/array/056.cr
@@ -1,3 +1,3 @@
# array.cr:1367
# array.cr:1365
a = [1, 2, 3]
a.reverse # => [3, 2, 1]

0 comments on commit 3be35bd

Please sign in to comment.