mabdi / mabdi/small-amp

Check this method.

Open
#89 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug TODO
Dominant language
Smalltalk
Stars
6
Forks
4
PR merge metrics
No merged PRs in 30d

Description

This method from zinc project:

testMultiValues
	| dictionary values keys |
	dictionary := ZnMultiValueDictionary new.
	dictionary at: 'foo' add: 1; at: 'foo' add: 2.
	self assert: (dictionary at: 'foo') = #(1 2).
	self assert: dictionary keys asArray = #('foo').
	values := OrderedCollection new.
	keys := OrderedCollection new.
	dictionary keysAndValuesDo: [ :key :value | keys add: key. values add: value ].
	self assert: values = (OrderedCollection with: 1 with: 2).
	self assert: keys = (OrderedCollection with: 'foo' with: 'foo')

is converted to it:

testMultiValues_amp_L20
	<madeBySmallAmp>
	| dictionary values keys |
	dictionary := ZnMultiValueDictionary new.
	dictionary := dictionary
		at: 'foo' add: 1;
		at: 'foo' add: 1.
	values := OrderedCollection new.
	keys := OrderedCollection new.
	 dictionary
				keysAndValuesDo: [ :key :value | 
					keys add: key.
					values add: value ] 

Line 5 of Which does not look correct. Why the dictionary variable is set to the result of Dictionary>>#at:add: ?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the original testMultiValues example in the issue and compare it with the generated testMultiValues_amp_L20 output. Inspect how small-amp converts the Dictionary>>#at:add: expression, then determine the expected transformed test and verify that the dictionary assignment and repeated values match the source behavior.

Written by the indexing model from the issue text.

Assessment

Domain
testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.