Kaynağa Gözat

Unit test for #{1->2->3}

Herbert Vojčík 10 yıl önce
ebeveyn
işleme
183bc064e8
2 değiştirilmiş dosya ile 25 ekleme ve 0 silme
  1. 21 0
      js/Compiler-Tests.js
  2. 4 0
      st/Compiler-Tests.st

+ 21 - 0
js/Compiler-Tests.js

@@ -512,6 +512,27 @@ referencedClasses: []
 }),
 globals.CodeGeneratorTest);
 
+smalltalk.addMethod(
+smalltalk.method({
+selector: "testDynamicDictionaryWithMoreArrows",
+protocol: 'tests',
+fn: function (){
+var self=this;
+function $HashedCollection(){return globals.HashedCollection||(typeof HashedCollection=="undefined"?nil:HashedCollection)}
+return smalltalk.withContext(function($ctx1) { 
+var $2,$1;
+$2=_st((1).__minus_gt((2))).__minus_gt((3));
+$ctx1.sendIdx["->"]=1;
+$1=_st($HashedCollection())._with_($2);
+self._should_return_("foo ^ #{1->2->3}",$1);
+return self}, function($ctx1) {$ctx1.fill(self,"testDynamicDictionaryWithMoreArrows",{},globals.CodeGeneratorTest)})},
+args: [],
+source: "testDynamicDictionaryWithMoreArrows\x0a\x09self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)",
+messageSends: ["should:return:", "with:", "->"],
+referencedClasses: ["HashedCollection"]
+}),
+globals.CodeGeneratorTest);
+
 smalltalk.addMethod(
 smalltalk.method({
 selector: "testGlobalVar",

+ 4 - 0
st/Compiler-Tests.st

@@ -203,6 +203,10 @@ testDynamicDictionaryElementsOrdered
 ' return: #{'foo'->1. 'bar'->2}.
 !
 
+testDynamicDictionaryWithMoreArrows
+	self should: 'foo ^ #{1->2->3}' return: (HashedCollection with: 1->2->3)
+!
+
 testGlobalVar
 	self should: 'foo ^ eval class' return: BlockClosure.
 	self should: 'foo ^ Math cos: 0' return: 1.