<commit_before>Class {
	#name : #NewMethodFinderTest,
	#superclass : #TestCase,
	#category : #NewMethodFinder
}

{ #category : #tests }
NewMethodFinderTest >> testArgumentsNumber [
	"The Method Finder should returns sends with the good number of arguments."
	
	|bottom resultZero resultOne |
	bottom := NewMethodFinderBottomClass new.
	resultZero := (NewMethodFinder new findMethodsByExampleInput: { bottom } andExpectedResult: bottom).
	resultOne  := (NewMethodFinder new findMethodsByExampleInput: { bottom . bottom } andExpectedResult: bottom).
	self assert: ((resultZero collect: #selector) allSatisfy: [ :s | s keywords size = 1]).
	self assert: ((resultOne  collect: #selector) allSatisfy: [ :s | s keywords size = 1 and: s last = $:]).
]

{ #category : #tests }
NewMethodFinderTest >> testExceptionDoesNotStopTheFlow [

	| bottom result |
	bottom := NewMethodFinderBottomClass new.
	result := (NewMethodFinder new findMethodsByExampleInput: { bottom . 1 } andExpectedResult: 1).
	self assert: ((result collect: #selector) includes: #oneArgumentMethod:).
]

{ #category : #tests }
NewMethodFinderTest >> testForbiddenSetIsOverApprovedSet [

	| bottom result |
	bottom := NewMethodFinderBottomClass new.
	result := (NewMethodFinder new findMethodsByExampleInput: { bottom } andExpectedResult: bottom ).
	self assert: (((result collect: #selector) includes: #InApprovedAndInForbiddenSetMethod) not).
]<commit_msg>Adds test for exception management.<commit_after>Class {
	#name : #NewMethodFinderTest,
	#superclass : #TestCase,
	#category : #NewMethodFinder
}

{ #category : #tests }
NewMethodFinderTest >> testArgumentsNumber [
	"The Method Finder should returns sends with the good number of arguments."
	
	|bottom resultZero resultOne |
	bottom := NewMethodFinderBottomClass new.
	resultZero := (NewMethodFinder new findMethodsByExampleInput: { bottom } andExpectedResult: bottom).
	resultOne  := (NewMethodFinder new findMethodsByExampleInput: { bottom . bottom } andExpectedResult: bottom).
	self assert: ((resultZero collect: #selector) allSatisfy: [ :s | s keywords size = 1]).
	self assert: ((resultOne  collect: #selector) allSatisfy: [ :s | s keywords size = 1 and: s last = $:]).
]

{ #category : #tests }
NewMethodFinderTest >> testExceptionDoesNotStopTheFlow [

	| bottom result |
	bottom := NewMethodFinderBottomClass new.
	result := (NewMethodFinder new findMethodsByExampleInput: { bottom . 1 } andExpectedResult: 1).
	self assert: ((result collect: #selector) includes: #oneArgumentMethod:).
]

{ #category : #tests }
NewMethodFinderTest >> testExceptionInWrongEqualityReturns [

	self should: [ { 1.2.3 } = (3 to: {5}) ] raise: Error. 
	self deny: ((NewMethodFinderSend new to: 3 selector: #to: withArgs: { 5 }) resultIn: { 1.2.3 }). 
]

{ #category : #tests }
NewMethodFinderTest >> testForbiddenSetIsOverApprovedSet [

	| bottom result |
	bottom := NewMethodFinderBottomClass new.
	result := (NewMethodFinder new findMethodsByExampleInput: { bottom } andExpectedResult: bottom ).
	self assert: (((result collect: #selector) includes: #InApprovedAndInForbiddenSetMethod) not).
]
{'fraction_non_alphanumeric': 0.1132258064516129, 'fraction_numerical': 0.005806451612903226, 'mean_word_length': 5.473903966597077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3741979', 'n_tokens_mistral': 913, 'n_tokens_neox': 920, 'n_words': 262}