mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 04:22:25 -05:00 
			
		
		
		
	Grand test fixup (#138)
* start fixing up tests * fix up tests + automate with drone * fiddle with linting * messing about with drone.yml * some more fiddling * hmmm * add cache * add vendor directory * verbose * ci updates * update some little things * update sig
This commit is contained in:
		
					parent
					
						
							
								329a5e8144
							
						
					
				
			
			
				commit
				
					
						98263a7de6
					
				
			
		
					 2677 changed files with 1090869 additions and 219 deletions
				
			
		
							
								
								
									
										60
									
								
								vendor/github.com/aymerick/douceur/css/declaration.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										60
									
								
								vendor/github.com/aymerick/douceur/css/declaration.go
									
										
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							|  | @ -0,0 +1,60 @@ | |||
| package css | ||||
| 
 | ||||
| import "fmt" | ||||
| 
 | ||||
| // Declaration represents a parsed style property | ||||
| type Declaration struct { | ||||
| 	Property  string | ||||
| 	Value     string | ||||
| 	Important bool | ||||
| } | ||||
| 
 | ||||
| // NewDeclaration instanciates a new Declaration | ||||
| func NewDeclaration() *Declaration { | ||||
| 	return &Declaration{} | ||||
| } | ||||
| 
 | ||||
| // Returns string representation of the Declaration | ||||
| func (decl *Declaration) String() string { | ||||
| 	return decl.StringWithImportant(true) | ||||
| } | ||||
| 
 | ||||
| // StringWithImportant returns string representation with optional !important part | ||||
| func (decl *Declaration) StringWithImportant(option bool) string { | ||||
| 	result := fmt.Sprintf("%s: %s", decl.Property, decl.Value) | ||||
| 
 | ||||
| 	if option && decl.Important { | ||||
| 		result += " !important" | ||||
| 	} | ||||
| 
 | ||||
| 	result += ";" | ||||
| 
 | ||||
| 	return result | ||||
| } | ||||
| 
 | ||||
| // Equal returns true if both Declarations are equals | ||||
| func (decl *Declaration) Equal(other *Declaration) bool { | ||||
| 	return (decl.Property == other.Property) && (decl.Value == other.Value) && (decl.Important == other.Important) | ||||
| } | ||||
| 
 | ||||
| // | ||||
| // DeclarationsByProperty | ||||
| // | ||||
| 
 | ||||
| // DeclarationsByProperty represents sortable style declarations | ||||
| type DeclarationsByProperty []*Declaration | ||||
| 
 | ||||
| // Implements sort.Interface | ||||
| func (declarations DeclarationsByProperty) Len() int { | ||||
| 	return len(declarations) | ||||
| } | ||||
| 
 | ||||
| // Implements sort.Interface | ||||
| func (declarations DeclarationsByProperty) Swap(i, j int) { | ||||
| 	declarations[i], declarations[j] = declarations[j], declarations[i] | ||||
| } | ||||
| 
 | ||||
| // Implements sort.Interface | ||||
| func (declarations DeclarationsByProperty) Less(i, j int) bool { | ||||
| 	return declarations[i].Property < declarations[j].Property | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue