import Foundation import Testing @testable import NorgKit struct InlineStyleTests { @Test func combinesAndContains() { let style: InlineStyle = [.bold, .italic] #expect(style.contains(.bold)) #expect(style.contains(.italic)) #expect(!style.contains(.underline)) } @Test func distinctRawValues() { let all: [InlineStyle] = [ .bold, .italic, .underline, .strikethrough, .verbatim, .superscript, .subscript, .spoiler, .math, ] #expect(Set(all.map(\.rawValue)).count == all.count) } @Test func encodesAsSingleInteger() throws { let style: InlineStyle = [.bold, .verbatim] let data = try JSONEncoder().encode(style) #expect(String(data: data, encoding: .utf8) == "\(style.rawValue)") } @Test func roundTripsThroughJSON() throws { let style: InlineStyle = [.italic, .math, .spoiler] let data = try JSONEncoder().encode(style) let decoded = try JSONDecoder().decode(InlineStyle.self, from: data) #expect(decoded == style) } }