Combining the comments to the question and some quick experiments, here's what I've learned:
The syntax 'foo
is simply a shortcut for calling a lookup-or-create factory method that returns Symbol
instances.
Symbols are not glorified aliases for strings; one cannot simply use a Symbol instance as a String.
Not all strings can be symbols. White spaces, escapes etc are not valid characters in a symbol.
API designers can use these characteristics. In the OP, scalatest's matchers were asking for a function name not as a string, but as a Symbol. They are essentially overloading the be
function --
// String; actually AnyRef -- treat as a value comparison
string1 should be ("defined")
// calls the method on option1 and checks whether output == true
option1 should be ('defined)