summary: string summary should say characters, not elements

locals-and-roots
Björn Lindqvist 2016-03-25 14:46:37 +01:00
parent cf3e376ac0
commit e075ea02a8
2 changed files with 5 additions and 2 deletions

View File

@ -2,7 +2,7 @@ USING: combinators continuations kernel summary tools.test ;
IN: summary.tests
{ "array with 2 elements" } [ { 1 2 } summary ] unit-test
{ "string with 5 elements" } [ "hello" summary ] unit-test
{ "string with 5 characters" } [ "hello" summary ] unit-test
{ "hash-set with 3 members" } [ HS{ 1 2 3 } summary ] unit-test
{ "hashtable with 1 entries" } [ H{ { 3 4 } } summary ] unit-test
{ "Quotation's stack effect does not match call site" } [

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs classes continuations formatting kernel math
sequences sets ;
sequences sets strings ;
IN: summary
GENERIC: summary ( object -- string )
@ -30,6 +30,9 @@ M: object summary object-summary ;
M: sequence summary
dup length "elements" container-summary ;
M: string summary
dup length "characters" container-summary ;
! Override sequence => integer instance
M: f summary object-summary ;