Skip to content

Instantly share code, notes, and snippets.

@mythz
Created April 29, 2012 02:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mythz/2523357 to your computer and use it in GitHub Desktop.
Save mythz/2523357 to your computer and use it in GitHub Desktop.
The Dart Mixin (Underscore port) test runner output
1. Strings: Strings: capitalize (0, 3, 3)
1. First letter is upper case
Expected Fabio
2. Other letters unchanged
Expected FOO
3. Non string
Expected 123
2. Strings: Strings: reverse (0, 5, 5)
1. reverses 3-letter word
Expected oof
2. reverses 6-letter
Expected raboof
3. reverses 2 words
Expected rab oof
4. Non string
Expected 321
5. Non string
Expected 54.321
3. Strings: Strings: clean (0, 2, 2)
1. cleans spaced words
Expected foo bar
2. does not change numbers
Expected 123
4. Strings: String: titleize (0, 3, 3)
1. does titilize sentence
Expected The Titleize String Method
2. does not change word spacing
Expected The Titleize String Method
3. titleize leaves numbers
Expected 123
5. Strings: String: underscored (0, 5, 5)
1. can underscored dashes
Expected the_underscored_string_method
2. can underscored camelCase words
Expected the_underscored_string_method
3. can underscored PascalCase words
Expected the_underscored_string_method
4. can underscored spaced words
Expected the_underscored_string_method
5. underscores leaves numbers
Expected 123
6. Strings: String: dasherize (0, 8, 8)
1. can dasherize underscores
Expected the-dasherize-string-method
2. can dasherize PascalCase
Expected -the-dasherize-string-method
3. can dasherize spaced mix-case words
Expected this-is-a-test
4. can dasherize lower case words
Expected the-dasherize-string-method
5. can dasherize spaced words
Expected the-dasherize-string-method
6. can dasherize i18n words
Expected téléphone
7. dasherize leaves special chars
Expected foo$bar
8. dasherize leaves numbers
Expected 123
7. Strings: String: humanize (0, 7, 7)
1. can humanize underscores
Expected The humanize string method
2. can humanize PascalCase
Expected Thehumanize string method
3. can humanize sentence
Expected The humanize string method
4. can humanize repetitive id literal
Expected The humanize id string method
5. can humanize spaced words
Expected The humanize string method
6. can humanize mix
Expected Capitalize dash camel case underscore trim
7. humanize leaves numbers
Expected 123
8. Strings: String: truncate (0, 4, 4)
1. can truncate with suffix
Expected Hello read more
2. can truncate without suffix
Expected Hello...
3. truncate leaves short words
Expected Hello
4. can truncate numbers
Expected 12345...
9. Strings: String: isBlank (0, 5, 5)
1. empty string
2. single space
3. new line
4. a is not blank
5. string 0 is not blank
10. Strings: String: words (0, 5, 5)
1. handles !
Expected 3
2. handles spaced words
Expected 3
3. handles underscores
Expected 3
4. handles RegExp
Expected 3
5. handles numbers
Expected 1
11. Strings: String: chars (0, 2, 2)
1. does word
Expected 5
2. does number
Expected 3
12. Strings: String: lines (0, 3, 3)
1. does multiple lines
Expected 2
2. does single line
Expected 1
3. does number
Expected 1
13. Strings: String: lpad (0, 2, 2)
1. does char
Expected 1
2. does char with padStr
Expected 00000001
14. Strings: String: rpad (0, 4, 4)
1. does char
Expected 1
2. does char with padStr
Expected 10000000
3. does word with padStr 8
Expected foo00000
4. does word with padStr 7
Expected foo0000
15. Strings: String: lrpad (0, 5, 5)
1. does char
Expected 1
2. does char with padStr
Expected 00001000
3. does word with padStr 8
Expected 000foo00
4. does word with padStr 7
Expected 00foo00
5. does use partial padStr
Expected !!foo!!
16. Strings: Strings: stripTags (0, 4, 4)
1. can strip link
Expected a link
2. can strip link with js
Expected a linkalert("hello world!")
3. can strip html
Expected hello world
4. leaves number
Expected 123
17. Strings: Strings: repeat (0, 4, 4)
1. does not repeat without times
Expected
2. does 3 times
Expected foofoofoo
3. does number
Expected 123123
4. does with seperator
Expected 1234*1234
1. Mixin: Mixin: registerFactory (0, 2, 2)
1. can use custom extension
Expected 3
2. can use custom extension that uses base methods
Expected 50
2. Mixin: Mixin: mixin (0, 1, 1)
1. mixed in a function to _
Expected aecanap
1. Objects: objects: keys (0, 5, 5)
1. can extract the keys from an object
Expected one, two
2. throws an error for `null` values
3. throws an error for number primitives
4. throws an error for string primitives
5. throws an error for boolean primitives
2. Objects: objects: values (0, 1, 1)
1. can extract the values from an object
Expected 1, 2
3. Objects: objects: functions (0, 1, 1)
1. can grab the function names of any passed-in object
Expected [b, d]
4. Objects: objects: pick (0, 3, 3)
1. can restrict properties to those named
Expected {a: 1, c: 3}
2. can restrict properties to those named in an array
Expected {b: 2, c: 3}
3. can restrict properties to those named in mixed args
Expected {a: 1, b: 2}
5. Objects: objects: defaults (0, 6, 6)
1. value exists
Expected 0
2. value exists
Expected 1
3. default applied
Expected 20
4. value exists
Expected
5. NaN isn't overridden
6. new value is added, first one wins
Expected word
6. Objects: objects: clone (0, 6, 6)
1. the clone as the attributes of the original
Expected moe
2. clones can change shallow attributes without affecting the original
3. changes to deep attributes are shared with the original
Expected 101
4. non objects should not be changed by clone
Expected null
5. non objects should not be changed by clone
Expected 1
6. non objects should not be changed by clone
Expected null
7. Objects: objects: isEmpty (0, 10, 10)
1. [1] is not empty
2. [] is empty
3. {one : 1} is not empty
4. {} is empty
5. objects with prototype properties are empty
6. null is empty
7. undefined is empty
8. the empty string is empty
9. but other strings are not
10. deleting all the keys from an object empties it
8. Objects: objects: isObject (0, 7, 7)
1. and arrays
2. and functions
3. but not null
4. and not undefined
5. and not string
6. and not number
7. and not boolean
9. Objects: objects: isArray (0, 1, 1)
1. but arrays are
10. Objects: objects: isString (0, 1, 1)
1. but strings are
11. Objects: objects: isNumber (0, 6, 6)
1. a string is not a number
2. undefined is not a number
3. but numbers are
4. NaN *is* a number
5. Infinity is a number
6. numeric strings are not numbers
12. Objects: objects: isBoolean (0, 9, 9)
1. a number is not a boolean
2. a string is not a boolean
3. the string "false" is not a boolean
4. the string "true" is not a boolean
5. undefined is not a boolean
6. NaN is not a boolean
7. null is not a boolean
8. but true is
9. and so is false
13. Objects: objects: isFunction (0, 3, 3)
1. arrays are not functions
2. strings are not functions
3. but functions are
14. Objects: objects: isDate (0, 3, 3)
1. numbers are not dates
2. objects are not dates
3. but dates are
15. Objects: objects: isRegExp (0, 2, 2)
1. functions are not RegExps
2. but RegExps are
16. Objects: objects: isFinite (0, 10, 10)
1. undefined is not Finite
2. null is not Finite
3. NaN is not Finite
4. Infinity is not Finite
5. -Infinity is not Finite
6. Strings are not numbers
7. Number instances can be finite
8. 0 is Finite
9. Ints are Finite
10. Floats are Finite
17. Objects: objects: isNaN (0, 4, 4)
1. undefined is not NaN
2. null is not NaN
3. 0 is not NaN
4. but NaN is
18. Objects: objects: isNull (0, 2, 2)
1. NaN is not null
2. but null is
19. Objects: objects: tap (0, 3, 3)
1. passes tapped object to interceptor
Expected 1
2. returns tapped object
Expected 1
3. can use tapped objects in a chain
1. Utility: utility: identity (0, 1, 1)
1. moe is the same as his identity
Expected {name: moe}
2. Utility: utility: uniqueId (0, 1, 1)
1. can generate a globally-unique stream of ids
Expected 100
3. Utility: utility: times (0, 2, 2)
1. is 0 indexed
Expected [0, 1, 2]
2. works as a wrapper
Expected [0, 1, 2]
4. Utility: utility: _.escape (0, 2, 2)
1. does escape
Expected Curly & Moe
2. does double escape
Expected Curly & Moe
5. Utility: result calls functions and returns primitives (0, 5, 5)
1. returns empty string
Expected
2. returns normal property
Expected x
3. returns value of property function
Expected x
4. returns null for non-existant properties
Expected null
5. returns null when target is null
Expected null
1. Collections: collections: each (0, 5, 5)
1. each iterators provide value and iteration count
Expected 1
2. each iterators provide value and iteration count
Expected 2
3. each iterators provide value and iteration count
Expected 3
4. aliased as "forEach"
Expected 1, 2, 3
5. handles a null properly
Expected 0
2. Collections: collections: map (0, 5, 5)
1. doubled numbers
Expected 2, 4, 6
2. aliased as "collect"
Expected 2, 4, 6
3. OO-style doubled numbers
Expected 2, 4, 6
4. handles a null properly
5. can preserve a sparse array's length
Expected 2
3. Collections: collections: reduce (0, 6, 6)
1. can sum up an array
Expected 6
2. aliased as "inject"
Expected 6
3. OO-style reduce
Expected 6
4. default initial value
Expected 6
5. handles a null (without inital value) properly
6. handles a null (with initial value) properly
4. Collections: collections: reduceRight (0, 5, 5)
1. can perform right folds
Expected bazbarfoo
2. aliased as "foldr"
Expected bazbarfoo
3. default initial value
Expected bazbarfoo
4. handles a null (without inital value) properly
5. handles a null (with initial value) properly
5. Collections: collections: detect (0, 1, 1)
1. found the first "2" and broke the loop
Expected 2
6. Collections: collections: select (0, 2, 2)
1. selected each even number
Expected 2, 4, 6
2. aliased as "filter"
Expected 2, 4, 6
7. Collections: collections: reject (0, 1, 1)
1. rejected each even number
Expected 1, 3, 5
8. Collections: collections: all (0, 6, 6)
1. the empty set
2. all true values
3. one false value
4. even numbers
5. an odd number
6. aliased as "every"
9. Collections: collections: any (0, 8, 8)
1. the empty set
2. all false values
3. one true value
4. a string
5. falsy values
6. all odd numbers
7. an even number
8. aliased as "some"
10. Collections: collections: include (0, 4, 4)
1. two is in the array
2. two is not in the array
3. _.include on objects checks their values
4. OO-style include
11. Collections: collections: pluck (0, 1, 1)
1. pulls names out of objects
Expected moe, curly
12. Collections: collections: max (0, 4, 4)
1. can perform a regular Math.max
Expected 3
2. can perform a computation-based max
Expected 1
3. Maximum value of an empty object
Expected -Infinity
4. Maximum value of an empty array
Expected -Infinity
13. Collections: collections: min (0, 5, 5)
1. can perform a regular Math.min
Expected 1
2. can perform a computation-based min
Expected 3
3. Minimum value of an empty object
Expected Infinity
4. Minimum value of an empty array
Expected Infinity
5. can perform min on date
Expected 1970-01-01 00:00:00.000Z
14. Collections: collections: sortBy (0, 3, 3)
1. stooges sorted by age
Expected moe, curly
2. sortBy with undefined values
Expected 1,2,3,4,,
3. sorted by length
Expected one two four five three
15. Collections: collections: groupBy (0, 5, 5)
1. created a group for each value
2. put each even number in the right group
Expected 2, 4, 6
3. 1st group grouped by length
Expected one two six ten
4. 2nd group grouped by length
Expected four five nine
5. 3rd group grouped by length
Expected three seven eight
16. Collections: collections: sortedIndex (0, 2, 2)
1. 35 should be inserted at index 3
Expected 3
2. 30 should be inserted at index 2
Expected 2
17. Collections: collections: shuffle (0, 2, 2)
1. original object is unmodified
Expected [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
2. contains the same members before and after shuffle
Expected 0,1,2,3,4,5,6,7,8,9
18. Collections: collections: toArray (0, 5, 5)
1. array is cloned
2. cloned array contains same elements
Expected 1, 2, 3
3. object flattened into array
Expected 1, 2, 3
4. toArray method used if present
Expected 1, 2, 3
5. toArray property ignored if not a function
Expected 1
19. Collections: collections: size (0, 2, 2)
1. can compute the size of an object
Expected 3
2. can compute the size of an array
Expected 3
20. Collections: collections: insert (0, 2, 2)
1. can insert at start of the list
Expected [a, b, c, d]
2. can insert at end of the list
Expected [b, c, d, e]
1. Arrays: arrays: first (0, 7, 7)
1. can pull out the first element of an array
Expected 1
2. can pass an index to first
Expected
3. can pass an index to first
Expected 1, 2
4. can pass an index to first
Expected 1, 2, 3
5. works on an arguments object.
Expected 4
6. works well with _.map
Expected 1,1
7. aliased as take
Expected 1,2
2. Arrays: arrays: rest (0, 5, 5)
1. working rest()
Expected 2, 3, 4
2. working rest(0)
Expected 1, 2, 3, 4
3. rest can take an index
Expected 3, 4
4. aliased as tail and works on arguments object
Expected 2, 3, 4
5. works well with _.map
Expected 2,3,2,3
3. Arrays: arrays: initial (0, 4, 4)
1. working initial()
Expected 1, 2, 3, 4
2. initial can take an index
Expected 1, 2
3. initial works on arguments object
Expected 1, 2, 3
4. initial works with _.map
Expected 1,2,1,2
4. Arrays: arrays: last (0, 6, 6)
1. can pull out the last element of an array
Expected 3
2. can pass an index to last
Expected
3. can pass an index to last
Expected 2, 3
4. can pass an index to last
Expected 1, 2, 3
5. works on an arguments object
Expected 4
6. works well with _.map
Expected 3,3
5. Arrays: arrays: compact (0, 2, 2)
1. can trim out all falsy values
Expected 3
2. works on an arguments object
Expected 3
6. Arrays: arrays: flatten (0, 3, 3)
1. can flatten nested arrays
Expected [1,2,3,4]
2. can shallowly flatten nested arrays
Expected [1,2,3,[[[4]]]]
3. works on an arguments object
Expected [1,2,3,4]
7. Arrays: arrays: without (0, 4, 4)
1. can remove all instances of an object
Expected 2, 3, 4
2. works on an arguments object
Expected 2, 3, 4
3. uses real object identity for comparisons.
4. ditto.
8. Arrays: arrays: uniq (0, 7, 7)
1. can find the unique values of an unsorted array
Expected 1, 2, 3, 4
2. can find the unique values of a sorted array faster
Expected 1, 2, 3
3. can find the unique values of an array using a custom iterator
Expected moe, curly, larry
4. iterator works with sorted array
Expected 1, 2, 3, 4
5. works on an arguments object
Expected 1, 2, 3, 4
6. Works with sorted sparse arrays where `undefined` elements are elided
Expected [null, 2, 5, 8, hi]
7. The resulting array should not be sparse
Expected 5
9. Arrays: arrays: intersection (0, 3, 3)
1. can take the set intersection of two arrays
Expected moe
2. can perform an OO-style intersection
Expected moe
3. works on an arguments object
Expected moe
10. Arrays: arrays: union (0, 2, 2)
1. takes the union of a list of arrays
Expected 1 2 3 30 40
2. takes the union of a list of nested arrays
Expected 1 2 3 30 40 [1]
11. Arrays: arrays: difference (0, 2, 2)
1. takes the difference of two arrays
Expected 1 3
2. takes the difference of three arrays
Expected 3 4
12. Arrays: arrays: zip (0, 1, 1)
1. zipped together arrays of different lengths
Expected moe,30,true,larry,40,,curly,50,
13. Arrays: arrays: indexOf (0, 5, 5)
1. works on an arguments object
Expected 1
2. handles nulls properly
Expected -1
3. 35 is not in the list
Expected -1
4. 40 is in the list
Expected 3
5. 40 is in the list
Expected 1
14. Arrays: arrays: lastIndexOf (0, 3, 3)
1. lastIndexOf the other element
Expected 8
2. works on an arguments object
Expected 5
3. handles nulls properly
Expected -1
15. Arrays: arrays: range (0, 8, 8)
1. range with 0 as a first argument generates an empty array
Expected
2. range with a single positive argument generates an array of elements 0,1,2,...,n-1
Expected 0 1 2 3
3. range with two arguments a & b, a<b generates an array of elements a,a+1,a+2,...,b-2,b-1
Expected 5 6 7
4. range with two arguments a & b, b<a generates an empty array
Expected
5. range with three arguments a & b & c, c < b-a, a < b generates an array of elements a,a+c,a+2c,...,b - (multiplier of a) < c
Expected 3 6 9
6. range with three arguments a & b & c, c > b-a, a < b generates an array with a single element, equal to a
Expected 3
7. range with three arguments a & b & c, a > b, c < 0 generates an array of elements a,a-c,a-2c and ends with the number not less than b
Expected 12 10 8
8. final example in the Python docs
Expected 0 -1 -2 -3 -4 -5 -6 -7 -8 -9
Tests completed in 396ms
304 tests of 304 passed, 0 failed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment