Commit 3855cfb4a1
Copy SHA
3855cfb4a1a4927ac63e5aaa4b673ae8f28e4c37
parent: 778058aafc
Verified · cmc
cmc <hello@cleberg.net> · 2026-10-09 01:26 UTC
Run the sort-list oracle test in UTC
The oracle runs Emacs with TZ=UTC; items without a time sort as now, so
the two sides disagreed whenever the local date differed from UTC.
Changed files (2)
Tests/OrgCoreTests/EmacsOracle.swift
+3 −2 · view
@@ -162,8 +162,9 @@ func withOptions(_ options: EditingOptions, _ form: String) -> String {
162 let doomOptions = EditingOptions ( tagsColumn : 0 , insertHeadingRespectContent : true , metaReturnMaySplitLine : false , listAllowAlphabetical : true , fillColumn : 80 , hideEmphasisMarkers : true , prettyEntities : true , subSuperscriptsNeedBraces : true )
162 let doomOptions = EditingOptions ( tagsColumn : 0 , insertHeadingRespectContent : true , metaReturnMaySplitLine : false , listAllowAlphabetical : true , fillColumn : 80 , hideEmphasisMarkers : true , prettyEntities : true , subSuperscriptsNeedBraces : true )
163
163
164 // / R u n s a c o m m a n d t h e w a y a n e d i t o r w o u l d : b u i l d a c o n t e x t , r u n , a p p l y t h e e d i t s .
164 // / R u n s a c o m m a n d t h e w a y a n e d i t o r w o u l d : b u i l d a c o n t e x t , r u n , a p p l y t h e e d i t s .
165 func runCommand ( _ command : any OrgCommand , _ text : String , caret : Int , answers : [ String : String ] = [ : ] , options : EditingOptions = . org ) -> ( text : String , caret : Int , failure : String ? ) {
165 func runCommand ( _ command : any OrgCommand , _ text : String , caret : Int , answers : [ String : String ] = [ : ] , options : EditingOptions = . org ,
166 let context = EditContext ( revision : 0 , text : text , tree : OrgParser . parse ( text ) , selection : [ caret . . < caret ] , answers : answers , options : options )
166 calendar : Calendar = . current ) -> ( text : String , caret : Int , failure : String ? ) {
167 let context = EditContext ( revision : 0 , text : text , tree : OrgParser . parse ( text ) , selection : [ caret . . < caret ] , calendar : calendar , answers : answers , options : options )
167 switch command . run ( in : context ) {
168 switch command . run ( in : context ) {
168 case . commit ( let result ) :
169 case . commit ( let result ) :
169 var new = text
170 var new = text
Tests/OrgCoreTests/SortListTests.swift
+8 −1 · view
@@ -14,6 +14,12 @@ struct SortListTests {
14 " Intro \n - one \n - two \n continued \n - three \n Outro \n " ,
14 " Intro \n - one \n - two \n continued \n - three \n Outro \n " ,
15 ]
15 ]
16
16
17 static let utc : Calendar = {
18 var calendar = Calendar ( identifier : . gregorian )
19 calendar . timeZone = TimeZone ( identifier : " UTC " ) !
20 return calendar
21 } ( )
22
17 @ Test ( . enabled ( if : ProcessInfo . processInfo . environment [ " ORGSTAR_SKIP_ORACLE " ] = = nil ) )
23 @ Test ( . enabled ( if : ProcessInfo . processInfo . environment [ " ORGSTAR_SKIP_ORACLE " ] = = nil ) )
18 func matchesEmacs ( ) throws {
24 func matchesEmacs ( ) throws {
19 var cases : [ EmacsOracle . Case ] = [ ]
25 var cases : [ EmacsOracle . Case ] = [ ]
@@ -33,7 +39,8 @@ struct SortListTests {
33 for caret in carets . prefix ( 2 ) {
39 for caret in carets . prefix ( 2 ) {
34 for key in [ " a " , " A " , " n " , " N " , " t " , " T " , " x " , " X " ] {
40 for key in [ " a " , " A " , " n " , " N " , " t " , " T " , " x " , " X " ] {
35 cases . append ( EmacsOracle . Case ( text : text , point : EmacsOracle . point ( caret , in : text ) , form : " (org-sort-list nil ? \( key ) ) " ) )
41 cases . append ( EmacsOracle . Case ( text : text , point : EmacsOracle . point ( caret , in : text ) , form : " (org-sort-list nil ? \( key ) ) " ) )
36 ours . append ( runCommand ( SortEntries ( ) , text , caret : caret , answers : [ " sort " : key ] ) )
42 // I n U T C , a s t h e o r a c l e r u n s E m a c s : a n i t e m w i t h o u t a t i m e s o r t s a s n o w .
43 ours . append ( runCommand ( SortEntries ( ) , text , caret : caret , answers : [ " sort " : key ] , calendar : Self . utc ) )
37 }
44 }
38 }
45 }
39 }
46 }