mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 16:40:24 +08:00 
			
		
		
		
	Remove deadcode (#22245)
- Remove code that isn't being used. Found this is my stash from a few weeks ago, not sure how I found this in the first place. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
		@@ -95,64 +95,3 @@ func Test_nulSeparatedAttributeWriter_ReadAttribute(t *testing.T) {
 | 
			
		||||
		Value:     "unspecified",
 | 
			
		||||
	}, attr)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func Test_lineSeparatedAttributeWriter_ReadAttribute(t *testing.T) {
 | 
			
		||||
	wr := &lineSeparatedAttributeWriter{
 | 
			
		||||
		attributes: make(chan attributeTriple, 5),
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	testStr := `".gitignore\"\n": linguist-vendored: unspecified
 | 
			
		||||
`
 | 
			
		||||
	n, err := wr.Write([]byte(testStr))
 | 
			
		||||
 | 
			
		||||
	assert.Equal(t, n, len(testStr))
 | 
			
		||||
	assert.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
	select {
 | 
			
		||||
	case attr := <-wr.ReadAttribute():
 | 
			
		||||
		assert.Equal(t, ".gitignore\"\n", attr.Filename)
 | 
			
		||||
		assert.Equal(t, "linguist-vendored", attr.Attribute)
 | 
			
		||||
		assert.Equal(t, "unspecified", attr.Value)
 | 
			
		||||
	case <-time.After(100 * time.Millisecond):
 | 
			
		||||
		assert.Fail(t, "took too long to read an attribute from the list")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Write a second attribute again
 | 
			
		||||
	n, err = wr.Write([]byte(testStr))
 | 
			
		||||
 | 
			
		||||
	assert.Equal(t, n, len(testStr))
 | 
			
		||||
	assert.NoError(t, err)
 | 
			
		||||
 | 
			
		||||
	select {
 | 
			
		||||
	case attr := <-wr.ReadAttribute():
 | 
			
		||||
		assert.Equal(t, ".gitignore\"\n", attr.Filename)
 | 
			
		||||
		assert.Equal(t, "linguist-vendored", attr.Attribute)
 | 
			
		||||
		assert.Equal(t, "unspecified", attr.Value)
 | 
			
		||||
	case <-time.After(100 * time.Millisecond):
 | 
			
		||||
		assert.Fail(t, "took too long to read an attribute from the list")
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Write a partial attribute
 | 
			
		||||
	_, err = wr.Write([]byte("incomplete-file"))
 | 
			
		||||
	assert.NoError(t, err)
 | 
			
		||||
	_, err = wr.Write([]byte("name: "))
 | 
			
		||||
	assert.NoError(t, err)
 | 
			
		||||
	select {
 | 
			
		||||
	case <-wr.ReadAttribute():
 | 
			
		||||
		assert.Fail(t, "There should not be an attribute ready to read")
 | 
			
		||||
	case <-time.After(100 * time.Millisecond):
 | 
			
		||||
	}
 | 
			
		||||
	_, err = wr.Write([]byte("attribute: "))
 | 
			
		||||
	assert.NoError(t, err)
 | 
			
		||||
	select {
 | 
			
		||||
	case <-wr.ReadAttribute():
 | 
			
		||||
		assert.Fail(t, "There should not be an attribute ready to read")
 | 
			
		||||
	case <-time.After(100 * time.Millisecond):
 | 
			
		||||
	}
 | 
			
		||||
	_, err = wr.Write([]byte("value\n"))
 | 
			
		||||
	assert.NoError(t, err)
 | 
			
		||||
	attr := <-wr.ReadAttribute()
 | 
			
		||||
	assert.Equal(t, "incomplete-filename", attr.Filename)
 | 
			
		||||
	assert.Equal(t, "attribute", attr.Attribute)
 | 
			
		||||
	assert.Equal(t, "value", attr.Value)
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user