"The food tastes of oninon." is absolutely right. I think.
but how about "The food tastes of sweetness. ?
Is it right? Is it awkward?
Yeah, it's a bit awkward.
Better to say that 'the food is sweet' or 'the food tastes sweet'.
If you wanted to use the word 'sweetness', you could say that 'there is a sweetness about the food/curry/wine'