@@ -25,12 +25,18 @@ class EngineForwardsTester < Minitest::Test
2525 OSC_HANDLER = File . join ( ROOT , "app/api/src/osc/osc_handler.cpp" )
2626 SPIDER = File . join ( ROOT , "app/server/ruby/bin/spider-server.rb" )
2727
28+ # The sources are UTF-8 whatever the locale says: Debian's build runs
29+ # under C, where a plain read stops at the first non-ASCII byte.
30+ def source ( path )
31+ File . read ( path , encoding : "UTF-8" )
32+ end
33+
2834 def gui_handled
29- File . read ( OSC_HANDLER ) . scan ( %r{match\( "(/clockwork/[^"]+)"\) } ) . flatten . uniq
35+ source ( OSC_HANDLER ) . scan ( %r{match\( "(/clockwork/[^"]+)"\) } ) . flatten . uniq
3036 end
3137
3238 def sent_to_gui_by_spider
33- File . read ( SPIDER ) . scan ( %r{gui\. send\( "(/clockwork/[^"]+)"} ) . flatten . uniq
39+ source ( SPIDER ) . scan ( %r{gui\. send\( "(/clockwork/[^"]+)"} ) . flatten . uniq
3440 end
3541
3642 def test_the_gui_handlers_are_found
@@ -67,7 +73,7 @@ def test_the_gui_never_asks_the_engine_directly_what_the_daemon_relays
6773 sources = Dir [ File . join ( ROOT , "app/gui/**/*.{cpp,h}" ) ] +
6874 Dir [ File . join ( ROOT , "app/api/src/**/*.{cpp,h}" ) ]
6975 direct = GUI_TO_ENGINE_REQUESTS . values . flat_map do |request |
70- sources . select { |f | File . read ( f ) . include? ( "\" #{ request } \" " ) }
76+ sources . select { |f | source ( f ) . include? ( "\" #{ request } \" " ) }
7177 . map { |f | "#{ request } in #{ f . delete_prefix ( ROOT + '/' ) } " }
7278 end
7379 assert_empty direct , "answers to these are discarded: ask through the daemon"
@@ -85,7 +91,7 @@ def test_the_gui_hears_every_setup
8591 end
8692
8793 def test_the_daemon_forwards_every_setup_unfiltered
88- daemon = File . read ( File . join ( __dir__ , "../bin/daemon.rb" ) )
94+ daemon = source ( File . join ( __dir__ , "../bin/daemon.rb" ) )
8995 refute_match ( /SetupGenerations|rebuild\? / , daemon )
9096 end
9197 end
0 commit comments